version 1.12, 2019/02/16 23:16:54 |
version 1.13, 2019/02/17 16:34:04 |
|
|
send_up_reset(struct send_up *p) |
send_up_reset(struct send_up *p) |
{ |
{ |
|
|
assert(NULL != p); |
assert(p != NULL); |
|
|
/* Free the download request, if applicable. */ |
/* Free the download request, if applicable. */ |
|
|
|
|
|
|
if (pfd[1].revents & POLLOUT) { |
if (pfd[1].revents & POLLOUT) { |
assert(pfd[2].fd == -1); |
assert(pfd[2].fd == -1); |
assert(0 == wbufpos && 0 == wbufsz); |
assert(wbufpos == 0 && wbufsz == 0); |
|
|
/* |
/* |
* If we have data to write, do it now according |
* If we have data to write, do it now according |
|
|
(intmax_t)up.stat.total / 1024, |
(intmax_t)up.stat.total / 1024, |
100.0 * up.stat.dirty / up.stat.total); |
100.0 * up.stat.dirty / up.stat.total); |
send_up_reset(&up); |
send_up_reset(&up); |
} else if (NULL != up.cur && up.cur->idx < 0) { |
} else if (up.cur != NULL && up.cur->idx < 0) { |
/* |
/* |
* We've hit the phase change following |
* We've hit the phase change following |
* the last file (or start, or prior |
* the last file (or start, or prior |
|
|
|
|
if (phase++) |
if (phase++) |
break; |
break; |
} else if (NULL != up.cur && 0 == up.primed) { |
} else if (up.cur != NULL && up.primed == 0) { |
/* |
/* |
* We're getting ready to send the file |
* We're getting ready to send the file |
* contents to the receiver. |
* contents to the receiver. |
|
|
fl[up.cur->idx].path, |
fl[up.cur->idx].path, |
(intmax_t)up.cur->blks->size); |
(intmax_t)up.cur->blks->size); |
up.primed = 1; |
up.primed = 1; |
} else if (NULL != up.cur) { |
} else if (up.cur != NULL) { |
/* |
/* |
* Our last case: we need to find the |
* Our last case: we need to find the |
* next block (and token) to transmit to |
* next block (and token) to transmit to |