diff options
author | Steven Danneman <steven.danneman@isilon.com> | 2008-09-03 15:31:39 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2008-09-04 11:50:25 -0700 |
commit | 304554115a2f2dc316386a9ea5bec237d67f595f (patch) | |
tree | 31a234031804f712e6be3608c8d094fdd20518c9 /source3/lib | |
parent | c16f2907c5f7a66b3e5d58af8f87ad35c5f77670 (diff) | |
download | samba-304554115a2f2dc316386a9ea5bec237d67f595f.tar.gz samba-304554115a2f2dc316386a9ea5bec237d67f595f.tar.bz2 samba-304554115a2f2dc316386a9ea5bec237d67f595f.zip |
Cleanup of DC enumeration in get_dcs()
This is a fix for a few small inefficiencies/bugs in the get_dcs() path.
* because the third add_one_dc_unique() loop was outside the ADS check all DCs
returned from the non-sitename lookup were being tacked onto the dc_name_ip
list twice.
* add_one_dc_unique() now checks if the given IP address already exists before
adding it to the list, making the returned list actually unique
* added more thorough doxygen comment headers
(This used to be commit cb2d488e1dbd90953c496c5e25d648977884f7e3)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/util_sock.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c index 7356b3ec35..e20768ed89 100644 --- a/source3/lib/util_sock.c +++ b/source3/lib/util_sock.c @@ -1379,11 +1379,22 @@ int open_socket_out(int type, return res; } -/**************************************************************************** - Create an outgoing TCP socket to any of the addrs. This is for - simultaneous connects to port 445 and 139 of a host or even a variety - of DC's all of which are equivalent for our purposes. -**************************************************************************/ +/******************************************************************* + Create an outgoing TCP socket to the first addr that connects. + + This is for simultaneous connection attempts to port 445 and 139 of a host + or for simultatneous connection attempts to multiple DCs at once. We return + a socket fd of the first successful connection. + + @param[in] addrs list of Internet addresses and ports to connect to + @param[in] num_addrs number of address/port pairs in the addrs list + @param[in] timeout time after which we stop waiting for a socket connection + to succeed, given in milliseconds + @param[out] fd_index the entry in addrs which we successfully connected to + @param[out] fd fd of the open and connected socket + @return true on a successful connection, false if all connection attempts + failed or we timed out +*******************************************************************/ bool open_any_socket_out(struct sockaddr_storage *addrs, int num_addrs, int timeout, int *fd_index, int *fd) |