diff options
author | Jeremy Allison <jra@samba.org> | 2004-11-19 19:32:31 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 10:53:23 -0500 |
commit | a68172ce7cc6c3c9cb02c1b07add9ad1c9c50bbe (patch) | |
tree | e511ff86b065116ad32d12ba7a4fd14692dba6fa /source3/nmbd | |
parent | 7c93bdcdf8334d4f2140405a982ea02943c5553c (diff) | |
download | samba-a68172ce7cc6c3c9cb02c1b07add9ad1c9c50bbe.tar.gz samba-a68172ce7cc6c3c9cb02c1b07add9ad1c9c50bbe.tar.bz2 samba-a68172ce7cc6c3c9cb02c1b07add9ad1c9c50bbe.zip |
r3877: Final (I hope :-) fix for #2050 from Lars Müller for select maxfd's.
Jeremy.
(This used to be commit 65fc39fc388244923d1e36076b5a4116aa434be5)
Diffstat (limited to 'source3/nmbd')
-rw-r--r-- | source3/nmbd/nmbd_packets.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c index 9dd2d05e14..a81b28ec74 100644 --- a/source3/nmbd/nmbd_packets.c +++ b/source3/nmbd/nmbd_packets.c @@ -1635,16 +1635,6 @@ on subnet %s\n", rrec->response_id, inet_ntoa(rrec->packet->ip), subrec->subnet_ } /**************************************************************************** - Check and if required set the highest fd. -***************************************************************************/ - -void check_set_maxfd( int *maxfd, int fd) -{ - if ( *maxfd < fd ) - *maxfd = fd; -} - -/**************************************************************************** Create an fd_set containing all the sockets in the subnet structures, plus the broadcast sockets. ***************************************************************************/ @@ -1682,25 +1672,25 @@ only use %d.\n", (count*2) + 2, FD_SETSIZE)); /* Add in the broadcast socket on 137. */ FD_SET(ClientNMB,pset); sock_array[num++] = ClientNMB; - check_set_maxfd( maxfd, ClientNMB); + *maxfd = MAX( *maxfd, ClientNMB); /* Add in the 137 sockets on all the interfaces. */ for (subrec = FIRST_SUBNET; subrec; subrec = NEXT_SUBNET_EXCLUDING_UNICAST(subrec)) { FD_SET(subrec->nmb_sock,pset); sock_array[num++] = subrec->nmb_sock; - check_set_maxfd( maxfd, subrec->nmb_sock); + *maxfd = MAX( *maxfd, subrec->nmb_sock); } /* Add in the broadcast socket on 138. */ FD_SET(ClientDGRAM,pset); sock_array[num++] = ClientDGRAM; - check_set_maxfd( maxfd, ClientDGRAM); + *maxfd = MAX( *maxfd, ClientDGRAM); /* Add in the 138 sockets on all the interfaces. */ for (subrec = FIRST_SUBNET; subrec; subrec = NEXT_SUBNET_EXCLUDING_UNICAST(subrec)) { FD_SET(subrec->dgram_sock,pset); sock_array[num++] = subrec->dgram_sock; - check_set_maxfd( maxfd, subrec->dgram_sock); + *maxfd = MAX( *maxfd, subrec->dgram_sock); } *listen_number = (count*2) + 2; @@ -1725,7 +1715,7 @@ BOOL listen_for_packets(BOOL run_election) static int listen_number = 0; static int *sock_array = NULL; int i; - int maxfd = 0; + static int maxfd = 0; fd_set fds; int selrtn; @@ -1748,7 +1738,7 @@ BOOL listen_for_packets(BOOL run_election) dns_fd = asyncdns_fd(); if (dns_fd != -1) { FD_SET(dns_fd, &fds); - check_set_maxfd( &maxfd, dns_fd); + maxfd = MAX( maxfd, dns_fd); } #endif |