[BACK]Return to tcpbench.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / tcpbench

Diff for /src/usr.bin/tcpbench/tcpbench.c between version 1.26 and 1.27

version 1.26, 2011/10/01 06:23:53 version 1.27, 2011/10/07 02:46:48
Line 911 
Line 911 
                 TAILQ_INSERT_TAIL(&sc_queue, sc, entry);                  TAILQ_INSERT_TAIL(&sc_queue, sc, entry);
                 mainstats.nconns++;                  mainstats.nconns++;
                 set_slice_timer(mainstats.nconns > 0);                  set_slice_timer(mainstats.nconns > 0);
                 if (UDP_MODE)  
                         break;  
         }          }
         freeaddrinfo(aitop);          freeaddrinfo(aitop);
   
Line 1100 
Line 1098 
         if (UDP_MODE) {          if (UDP_MODE) {
                 hints.ai_socktype = SOCK_DGRAM;                  hints.ai_socktype = SOCK_DGRAM;
                 hints.ai_protocol = IPPROTO_UDP;                  hints.ai_protocol = IPPROTO_UDP;
         }          } else {
         else {  
                 hints.ai_socktype = SOCK_STREAM;                  hints.ai_socktype = SOCK_STREAM;
                 hints.ai_protocol = IPPROTO_TCP;                  hints.ai_protocol = IPPROTO_TCP;
         }          }
Line 1150 
Line 1147 
                 err(1, "malloc");                  err(1, "malloc");
         arc4random_buf(ptb->dummybuf, ptb->dummybuf_len);          arc4random_buf(ptb->dummybuf, ptb->dummybuf_len);
   
         if (UDP_MODE) {  
                 if ((udp_sc = calloc(1, sizeof(*udp_sc))) == NULL)  
                         err(1, "calloc");  
                 udp_sc->fd = -1;  
                 stats_prepare(udp_sc);  
         }  
   
         /* Setup libevent and signals */          /* Setup libevent and signals */
         event_init();          event_init();
         signal_set(&ev_sigterm, SIGTERM, signal_handler, NULL);          signal_set(&ev_sigterm, SIGTERM, signal_handler, NULL);
Line 1167 
Line 1157 
         signal_add(&ev_sighup, NULL);          signal_add(&ev_sighup, NULL);
         signal(SIGPIPE, SIG_IGN);          signal(SIGPIPE, SIG_IGN);
   
         if (TCP_MODE)          if (UDP_MODE) {
                 print_tcp_header();                  if ((udp_sc = calloc(1, sizeof(*udp_sc))) == NULL)
                           err(1, "calloc");
         if (UDP_MODE)                  udp_sc->fd = -1;
                   stats_prepare(udp_sc);
                 evtimer_set(&mainstats.timer, udp_process_slice, udp_sc);                  evtimer_set(&mainstats.timer, udp_process_slice, udp_sc);
         else          } else {
                   print_tcp_header();
                 evtimer_set(&mainstats.timer, tcp_process_slice, NULL);                  evtimer_set(&mainstats.timer, tcp_process_slice, NULL);
           }
   
         if (ptb->sflag) {          if (ptb->sflag)
                 server_init(aitop, udp_sc);                  server_init(aitop, udp_sc);
         } else          else
                 client_init(aitop, nconn, udp_sc, aib);                  client_init(aitop, nconn, udp_sc, aib);
   
         /* libevent main loop*/          /* libevent main loop*/

Legend:
Removed from v.1.26  
changed lines
  Added in v.1.27