]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:lib: remove unused open_socket_out_defer_send/recv
authorStefan Metzmacher <metze@samba.org>
Fri, 4 Apr 2025 11:48:54 +0000 (13:48 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 18 Apr 2025 10:17:29 +0000 (10:17 +0000)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/include/proto.h
source3/lib/util_sock.c

index 016e0657bb30fa436063aeb7f286c4165aa889f6..70df8b788470d51a6b217e130b61624eb5d4e0a5 100644 (file)
@@ -503,13 +503,6 @@ struct tevent_req *open_socket_out_send(TALLOC_CTX *mem_ctx,
                                        uint16_t port,
                                        int timeout);
 NTSTATUS open_socket_out_recv(struct tevent_req *req, int *pfd);
-struct tevent_req *open_socket_out_defer_send(TALLOC_CTX *mem_ctx,
-                                             struct tevent_context *ev,
-                                             struct timeval wait_time,
-                                             const struct sockaddr_storage *pss,
-                                             uint16_t port,
-                                             int timeout);
-NTSTATUS open_socket_out_defer_recv(struct tevent_req *req, int *pfd);
 const char *get_peer_addr(int fd, char *addr, size_t addr_len);
 
 struct tsocket_address;
index d4f05b84ce966b4452e5c1e2565b54ca3516fda9..3b543ebba15bf56d2f8a7231eb6ead71e01bee32 100644 (file)
@@ -554,108 +554,6 @@ NTSTATUS open_socket_out(const struct sockaddr_storage *pss, uint16_t port,
        return status;
 }
 
-struct open_socket_out_defer_state {
-       struct tevent_context *ev;
-       struct sockaddr_storage ss;
-       uint16_t port;
-       int timeout;
-       int fd;
-};
-
-static void open_socket_out_defer_waited(struct tevent_req *subreq);
-static void open_socket_out_defer_connected(struct tevent_req *subreq);
-
-struct tevent_req *open_socket_out_defer_send(TALLOC_CTX *mem_ctx,
-                                             struct tevent_context *ev,
-                                             struct timeval wait_time,
-                                             const struct sockaddr_storage *pss,
-                                             uint16_t port,
-                                             int timeout)
-{
-       struct tevent_req *req, *subreq;
-       struct open_socket_out_defer_state *state;
-
-       req = tevent_req_create(mem_ctx, &state,
-                               struct open_socket_out_defer_state);
-       if (req == NULL) {
-               return NULL;
-       }
-       state->ev = ev;
-       state->ss = *pss;
-       state->port = port;
-       state->timeout = timeout;
-
-       subreq = tevent_wakeup_send(
-               state, ev,
-               timeval_current_ofs(wait_time.tv_sec, wait_time.tv_usec));
-       if (subreq == NULL) {
-               goto fail;
-       }
-       tevent_req_set_callback(subreq, open_socket_out_defer_waited, req);
-       return req;
- fail:
-       TALLOC_FREE(req);
-       return NULL;
-}
-
-static void open_socket_out_defer_waited(struct tevent_req *subreq)
-{
-       struct tevent_req *req = tevent_req_callback_data(
-               subreq, struct tevent_req);
-       struct open_socket_out_defer_state *state = tevent_req_data(
-               req, struct open_socket_out_defer_state);
-       bool ret;
-
-       ret = tevent_wakeup_recv(subreq);
-       TALLOC_FREE(subreq);
-       if (!ret) {
-               tevent_req_nterror(req, NT_STATUS_INTERNAL_ERROR);
-               return;
-       }
-
-       subreq = open_socket_out_send(state,
-                                     state->ev,
-                                     IPPROTO_TCP,
-                                     &state->ss,
-                                     state->port,
-                                     state->timeout);
-       if (tevent_req_nomem(subreq, req)) {
-               return;
-       }
-       tevent_req_set_callback(subreq, open_socket_out_defer_connected, req);
-}
-
-static void open_socket_out_defer_connected(struct tevent_req *subreq)
-{
-       struct tevent_req *req = tevent_req_callback_data(
-               subreq, struct tevent_req);
-       struct open_socket_out_defer_state *state = tevent_req_data(
-               req, struct open_socket_out_defer_state);
-       NTSTATUS status;
-
-       status = open_socket_out_recv(subreq, &state->fd);
-       TALLOC_FREE(subreq);
-       if (!NT_STATUS_IS_OK(status)) {
-               tevent_req_nterror(req, status);
-               return;
-       }
-       tevent_req_done(req);
-}
-
-NTSTATUS open_socket_out_defer_recv(struct tevent_req *req, int *pfd)
-{
-       struct open_socket_out_defer_state *state = tevent_req_data(
-               req, struct open_socket_out_defer_state);
-       NTSTATUS status;
-
-       if (tevent_req_is_nterror(req, &status)) {
-               return status;
-       }
-       *pfd = state->fd;
-       state->fd = -1;
-       return NT_STATUS_OK;
-}
-
 /*******************************************************************
  Return the IP addr of the remote end of a socket as a string.
  Optionally return the struct sockaddr_storage.