Revision a34ed273 loop.c

View differences:

loop.c
123 123
  }
124 124
  while (!done) {
125 125
    int len, res;
126
    struct timeval tv;
127
    int wait4fds[FDSSIZE];
126
    struct timeval tv, *ptv;
127
    int wait4fds[FDSSIZE], *pfds;
128 128

  
129 129
#ifdef HTTPIO
130 130
    memcpy(wait4fds, fds, sizeof(fds));
131 131
    res = wait4data(s, NULL, wait4fds);
132 132
#else
133
    tout_init(&tv);
134
    memcpy(wait4fds, fds, sizeof(fds));
135
    res = wait4data(s, &tv, wait4fds);
133
    if (fds[0] == -1) {
134
      tout_init(&tv);
135
      ptv = &tv;
136
      pfds = NULL;
137
    } else {
138
      memcpy(wait4fds, fds, sizeof(fds));
139
      pfds = wait4fds;
140
      ptv = NULL;
141
    }
142
    res = wait4data(s, ptv, pfds);
136 143
#endif
137 144
    if (res == 1) {
138 145
      struct nodeID *remote;

Also available in: Unified diff