From 03b8b8e19952c40eb3eb22e16e7fbae4073b7b4b Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 22 Dec 2010 14:40:16 +0100 Subject: s3: Remove unused open_any_socket_out Autobuild-User: Volker Lendecke Autobuild-Date: Wed Dec 22 17:27:29 CET 2010 on sn-devel-104 --- source3/include/proto.h | 2 - source3/lib/util_sock.c | 165 ------------------------------------------------ 2 files changed, 167 deletions(-) diff --git a/source3/include/proto.h b/source3/include/proto.h index 817a56b26b..f9bf72f7a3 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -1331,8 +1331,6 @@ struct tevent_req *open_socket_out_defer_send(TALLOC_CTX *mem_ctx, uint16_t port, int timeout); NTSTATUS open_socket_out_defer_recv(struct tevent_req *req, int *pfd); -bool open_any_socket_out(struct sockaddr_storage *addrs, int num_addrs, - int timeout, int *fd_index, int *fd); int open_udp_socket(const char *host, int port); const char *get_peer_name(int fd, bool force_lookup); const char *get_peer_addr(int fd, char *addr, size_t addr_len); diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c index 64cd74c328..8b25e012c6 100644 --- a/source3/lib/util_sock.c +++ b/source3/lib/util_sock.c @@ -1111,171 +1111,6 @@ NTSTATUS open_socket_out_defer_recv(struct tevent_req *req, int *pfd) return NT_STATUS_OK; } -/******************************************************************* - 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) -{ - int i, resulting_index, res; - int *sockets; - bool good_connect; - - fd_set r_fds, wr_fds; - struct timeval tv; - int maxfd; - - int connect_loop = 10000; /* 10 milliseconds */ - - timeout *= 1000; /* convert to microseconds */ - - sockets = SMB_MALLOC_ARRAY(int, num_addrs); - - if (sockets == NULL) - return false; - - resulting_index = -1; - - for (i=0; imaxfd) - maxfd = sockets[i]; - } - - tv.tv_sec = 0; - tv.tv_usec = connect_loop; - - res = sys_select_intr(maxfd+1, &r_fds, &wr_fds, NULL, &tv); - - if (res < 0) - goto done; - - if (res == 0) - goto next_round; - - for (i=0; i timeout) - connect_loop = timeout; - goto connect_again; - - done: - for (i=0; i= 0) - close(sockets[i]); - } - - if (resulting_index >= 0) { - *fd_index = resulting_index; - *fd = sockets[*fd_index]; - set_blocking(*fd, true); - } - - free(sockets); - - return (resulting_index >= 0); -} /**************************************************************************** Open a connected UDP socket to host on port **************************************************************************/ -- cgit