Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…in esnet#232 to master

* candlerb-candlerb-multisend:
  Drop out of multisend loop if none of the streams are accepting data
  • Loading branch information
bmah888 committed Jan 2, 2015
2 parents c0f4fa6 + bebb7de commit 59e1c29
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/iperf_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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))) {
Expand All @@ -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)
Expand All @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions src/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 59e1c29

Please sign in to comment.