[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.33 and 1.34

version 1.33, 2012/04/07 21:52:03 version 1.34, 2012/04/13 19:23:32
Line 610 
Line 610 
         ssize_t n;          ssize_t n;
         struct statctx *sc = v_sc;          struct statctx *sc = v_sc;
   
 again:  
         n = read(fd, ptb->dummybuf, ptb->dummybuf_len);          n = read(fd, ptb->dummybuf, ptb->dummybuf_len);
         if (n == 0)          if (n == 0)
                 return;                  return;
         else if (n == -1) {          else if (n == -1) {
                 if (errno == EINTR)                  if (errno != EINTR && errno != EWOULDBLOCK)
                         goto again;                          warn("fd %d read error", fd);
                 else if (errno == EWOULDBLOCK)  
                         return;  
                 warn("fd %d read error", fd);  
                 return;                  return;
         }          }
   
Line 639 
Line 635 
         struct statctx *sc = v_sc;          struct statctx *sc = v_sc;
         ssize_t n;          ssize_t n;
   
 again:  
         n = read(sc->fd, sc->buf, sc->buflen);          n = read(sc->fd, sc->buf, sc->buflen);
         if (n == -1) {          if (n == -1) {
                 if (errno == EINTR)                  if (errno != EINTR && errno != EWOULDBLOCK)
                         goto again;                          warn("fd %d read error", sc->fd);
                 else if (errno == EWOULDBLOCK)  
                         return;  
                 warn("fd %d read error", sc->fd);  
                 return;                  return;
         } else if (n == 0) {          } else if (n == 0) {
                 if (ptb->vflag)                  if (ptb->vflag)
Line 689 
Line 681 
         event_add(&ts->ev, NULL);          event_add(&ts->ev, NULL);
         if (event & EV_TIMEOUT)          if (event & EV_TIMEOUT)
                 return;                  return;
 again:  
         if ((sock = accept(fd, (struct sockaddr *)&ss, &sslen)) == -1) {          if ((sock = accept(fd, (struct sockaddr *)&ss, &sslen)) == -1) {
                 if (errno == EINTR)  
                         goto again;  
                 /*                  /*
                  * Pause accept if we are out of file descriptors, or                   * Pause accept if we are out of file descriptors, or
                  * libevent will haunt us here too.                   * libevent will haunt us here too.
Line 702 
Line 691 
   
                         event_del(&ts->ev);                          event_del(&ts->ev);
                         evtimer_add(&ts->evt, &evtpause);                          evtimer_add(&ts->evt, &evtpause);
                 } else                  } else if (errno != EWOULDBLOCK && errno != EINTR)
                         warn("accept");                          warn("accept");
                 return;                  return;
         }          }
Line 839 
Line 828 
         struct statctx *sc = v_sc;          struct statctx *sc = v_sc;
         ssize_t n;          ssize_t n;
   
 again:  
         if ((n = write(sc->fd, sc->buf, sc->buflen)) == -1) {          if ((n = write(sc->fd, sc->buf, sc->buflen)) == -1) {
                 if (errno == EINTR || errno == EAGAIN ||                  if (errno == EINTR || errno == EWOULDBLOCK ||
                     (UDP_MODE && errno == ENOBUFS))                      (UDP_MODE && errno == ENOBUFS))
                         goto again;                          return;
                 err(1, "write");                  err(1, "write");
         }          }
         if (TCP_MODE && n == 0) {          if (TCP_MODE && n == 0) {

Legend:
Removed from v.1.33  
changed lines
  Added in v.1.34