version 1.8, 2005/03/08 00:10:38
|
version 1.10, 2005/03/08 00:19:31
|
|
|
| |
for ( i = 0; i < n_connections; i++ ) | for ( i = 0; i < n_connections; i++ ) |
{ | { |
if ( FD_ISSET( mem->sock[i].s, &fds_recv ) ) { |
if ( ( mem->sock[i].n_recvd < n_expected ) && FD_ISSET( mem->sock[i].s, &fds_recv ) ) { |
| |
/* Receive data & check it */ | /* Receive data & check it */ |
mem->sock[i].n_recvd += recv ( mem->sock[i].s, mem->sock[i].buf + mem->sock[i].n_recvd, min ( n_expected - mem->sock[i].n_recvd, par->buflen ), 0 ); | mem->sock[i].n_recvd += recv ( mem->sock[i].s, mem->sock[i].buf + mem->sock[i].n_recvd, min ( n_expected - mem->sock[i].n_recvd, par->buflen ), 0 ); |
|
|
ok ( mem->sock[i].n_recvd <= n_expected, "select_server (%x): received too many bytes: %d\n", id, mem->sock[i].n_recvd ); | ok ( mem->sock[i].n_recvd <= n_expected, "select_server (%x): received too many bytes: %d\n", id, mem->sock[i].n_recvd ); |
} | } |
| |
if ( FD_ISSET ( mem->sock[i].s, &fds_send ) ) { |
if ( ( mem->sock[i].n_sent < n_expected ) && FD_ISSET ( mem->sock[i].s, &fds_send ) ) { |
| |
/* Echo data back */ | /* Echo data back */ |
mem->sock[i].n_sent += send ( mem->sock[i].s, mem->sock[i].buf + mem->sock[i].n_sent, min ( n_expected - mem->sock[i].n_sent, par->buflen ), 0 ); | mem->sock[i].n_sent += send ( mem->sock[i].s, mem->sock[i].buf + mem->sock[i].n_sent, min ( n_expected - mem->sock[i].n_sent, par->buflen ), 0 ); |
|
|
| |
/* check if all clients are done */ | /* check if all clients are done */ |
if ( ( fds_opensend.fd_count == 0 ) | if ( ( fds_opensend.fd_count == 0 ) |
|
&& ( fds_openrecv.fd_count == 1 ) /* initial socket that accepts clients */ |
&& ( n_connections == min ( gen->n_clients, MAX_CLIENTS ) ) ) { | && ( n_connections == min ( gen->n_clients, MAX_CLIENTS ) ) ) { |
break; | break; |
} | } |