(file) Return to sock.c CVS log (file) (dir) Up to [RizwankCVS] / wine4 / wine / dlls / winsock / tests

Diff for /wine4/wine/dlls/winsock/tests/sock.c between version 1.14 and 1.15

version 1.14, 2005/03/08 08:57:55 version 1.15, 2005/03/10 02:51:33
Line 383 
Line 383 
     test_params *gen = par->general;     test_params *gen = par->general;
     server_memory *mem;     server_memory *mem;
     int n_expected = gen->n_chunks * gen->chunk_size, tmp, i,     int n_expected = gen->n_chunks * gen->chunk_size, tmp, i,
         id = GetCurrentThreadId(), n_connections = 0, n_sent, n_recvd;          id = GetCurrentThreadId(), n_connections = 0, n_sent, n_recvd,
           n_set, delta, n_ready;
     char *p;     char *p;
     struct timeval zerotime = {0,0};      struct timeval timeout = {0,10}; /* wait for 10 milliseconds */
     fd_set fds_recv, fds_send, fds_openrecv, fds_opensend;     fd_set fds_recv, fds_send, fds_openrecv, fds_opensend;
  
     trace ( "select_server (%x) starting\n", id );     trace ( "select_server (%x) starting\n", id );
Line 412 
Line 413 
         fds_recv = fds_openrecv;         fds_recv = fds_openrecv;
         fds_send = fds_opensend;         fds_send = fds_opensend;
  
         wsa_ok ( select ( 0, &fds_recv, &fds_send, NULL, &zerotime ), SOCKET_ERROR !=,          n_set = 0;
   
           wsa_ok ( ( n_ready = select ( 0, &fds_recv, &fds_send, NULL, &timeout ) ), SOCKET_ERROR !=,
             "select_server (%lx): select() failed: %d\n" );             "select_server (%lx): select() failed: %d\n" );
  
         /* check for incoming requests */         /* check for incoming requests */
         if ( FD_ISSET ( mem->s, &fds_recv ) ) {         if ( FD_ISSET ( mem->s, &fds_recv ) ) {
               n_set += 1;
   
             trace ( "select_server (%x): accepting client connection\n", id );             trace ( "select_server (%x): accepting client connection\n", id );
  
             /* accept a single connection */             /* accept a single connection */
Line 438 
Line 443 
  
         for ( i = 0; i < n_connections; i++ )         for ( i = 0; i < n_connections; i++ )
         {         {
             if ( ( mem->sock[i].n_recvd < n_expected ) && FD_ISSET( mem->sock[i].s, &fds_recv ) ) {              if ( FD_ISSET( mem->sock[i].s, &fds_recv ) ) {
                   n_set += 1;
  
                   if ( mem->sock[i].n_recvd < n_expected ) {
                 /* Receive data & check it */                 /* Receive data & check it */
                 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 );                 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 ( n_recvd != SOCKET_ERROR, "select_server (%x): error in recv(): %d\n", id, WSAGetLastError() );                 ok ( n_recvd != SOCKET_ERROR, "select_server (%x): error in recv(): %d\n", id, WSAGetLastError() );
Line 453 
Line 460 
  
                 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 ( ( mem->sock[i].n_sent < n_expected ) && ( mem->sock[i].n_recvd == n_expected ) && FD_ISSET ( mem->sock[i].s, &fds_send ) ) {              /* only echo back what we've received */
               delta = mem->sock[i].n_recvd - mem->sock[i].n_sent;
  
               if ( FD_ISSET ( mem->sock[i].s, &fds_send ) ) {
                   n_set += 1;
   
                   if ( ( delta > 0 ) && ( mem->sock[i].n_sent < n_expected ) ) {
                 /* Echo data back */                 /* Echo data back */
                 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 );                      n_sent = send ( mem->sock[i].s, mem->sock[i].buf + mem->sock[i].n_sent, min ( delta, par->buflen ), 0 );
                 ok ( n_sent != SOCKET_ERROR, "select_server (%x): error in send(): %d\n", id, WSAGetLastError() );                 ok ( n_sent != SOCKET_ERROR, "select_server (%x): error in send(): %d\n", id, WSAGetLastError() );
                 mem->sock[i].n_sent += n_sent;                 mem->sock[i].n_sent += n_sent;
  
Line 468 
Line 481 
                 ok ( mem->sock[i].n_sent <= n_expected, "select_server (%x): sent too many bytes: %d\n", id, mem->sock[i].n_sent );                 ok ( mem->sock[i].n_sent <= n_expected, "select_server (%x): sent too many bytes: %d\n", id, mem->sock[i].n_sent );
             }             }
         }         }
           }
   
           /* check that select returned the correct number of ready sockets */
           ok ( ( n_set == n_ready ), "select_server (%x): select() returns wrong number of ready sockets\n", id );
  
         /* check if all clients are done */         /* check if all clients are done */
         if ( ( fds_opensend.fd_count == 0 )         if ( ( fds_opensend.fd_count == 0 )


Legend:
Removed from v.1.14  
changed lines
  Added in v.1.15

Rizwan Kassim
Powered by
ViewCVS 0.9.2