Revision 92bdbfcd som/net_helper.c

View differences:

som/net_helper.c
21 21
  int fd;
22 22
};
23 23

  
24
int wait4data(const struct nodeID *s, struct timeval *tout)
24
int wait4data(const struct nodeID *s, struct timeval *tout, fd_set *user_fds)
25 25
{
26 26
  fd_set fds;
27 27
  int res;
28 28

  
29 29
  FD_ZERO(&fds);
30
  FD_SET(s->fd, &fds);
31
  res = select(s->fd + 1, &fds, NULL, NULL, tout);
30
  if (user_fds == NULL) {
31
    user_fds = &fds;
32
  }
33
  FD_SET(s->fd, user_fds);
34
  res = select(s->fd + 1, user_fds, NULL, NULL, tout);
35
  if (res <= 0) {
36
    return res;
37
  }
32 38
  if (FD_ISSET(s->fd, &fds)) {
33 39
    return 1;
34 40
  }
35 41

  
36
  return 0;
42
  return 2;
37 43
}
38 44

  
39 45
struct nodeID *create_node(const char *IPaddr, int port)

Also available in: Unified diff