Merge branch 'candlerb-multisend' of https://github.com/candlerb/iperf into candlerb-candlerb-multisend

This commit is contained in:
Bruce A. Mah 2015-01-02 10:00:37 -08:00
commit bebb7dea76
2 changed files with 7 additions and 1 deletions

View File

@ -1002,7 +1002,7 @@ iperf_check_throttle(struct iperf_stream *sp, struct timeval *nowP)
int
iperf_send(struct iperf_test *test, fd_set *write_setP)
{
register int multisend, r;
register int multisend, r, streams_active;
register struct iperf_stream *sp;
struct timeval now;
@ -1017,6 +1017,7 @@ iperf_send(struct iperf_test *test, fd_set *write_setP)
for (; multisend > 0; --multisend) {
if (test->settings->rate != 0 && test->settings->burst == 0)
gettimeofday(&now, NULL);
streams_active = 0;
SLIST_FOREACH(sp, &test->streams, streams) {
if (sp->green_light &&
(write_setP == NULL || FD_ISSET(sp->socket, write_setP))) {
@ -1026,6 +1027,7 @@ iperf_send(struct iperf_test *test, fd_set *write_setP)
i_errno = IESTREAMWRITE;
return r;
}
streams_active = 1;
test->bytes_sent += r;
++test->blocks_sent;
if (test->settings->rate != 0 && test->settings->burst == 0)
@ -1036,6 +1038,8 @@ iperf_send(struct iperf_test *test, fd_set *write_setP)
break;
}
}
if (!streams_active)
break;
}
if (test->settings->burst != 0) {
gettimeofday(&now, NULL);

View File

@ -320,6 +320,8 @@ Nsendfile(int fromfd, int tofd, const char *buf, size_t count)
switch (errno) {
case EINTR:
case EAGAIN:
if (count == nleft)
return NET_SOFTERROR;
return count - nleft;
case ENOBUFS: