summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2009-01-03 12:47:24 +0100
committerStefan Metzmacher <metze@samba.org>2009-01-03 19:58:53 +0100
commit5fa0d3d56824f4ef3dfdb0f97c836554a62c4875 (patch)
tree6973a352fc244df2641655e9c645f319a0632970 /source4/lib
parentb1be241ca5d7f02be93bd3582b98d428b1e207ce (diff)
downloadsamba-5fa0d3d56824f4ef3dfdb0f97c836554a62c4875.tar.gz
samba-5fa0d3d56824f4ef3dfdb0f97c836554a62c4875.tar.bz2
samba-5fa0d3d56824f4ef3dfdb0f97c836554a62c4875.zip
s4:socket: use a socket_wrapper aware function to auto close the fd event for sockets
metze
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/socket/socket.c9
-rw-r--r--source4/lib/socket/socket.h6
2 files changed, 15 insertions, 0 deletions
diff --git a/source4/lib/socket/socket.c b/source4/lib/socket/socket.c
index 26cdac99a3..9d30e0a77e 100644
--- a/source4/lib/socket/socket.c
+++ b/source4/lib/socket/socket.c
@@ -37,6 +37,15 @@ static int socket_destructor(struct socket_context *sock)
return 0;
}
+_PUBLIC_ void socket_tevent_fd_close_fn(struct tevent_context *ev,
+ struct tevent_fd *fde,
+ int fd,
+ void *private_data)
+{
+ /* this might be the socket_wrapper swrap_close() */
+ close(fd);
+}
+
_PUBLIC_ NTSTATUS socket_create_with_ops(TALLOC_CTX *mem_ctx, const struct socket_ops *ops,
struct socket_context **new_sock,
enum socket_type type, uint32_t flags)
diff --git a/source4/lib/socket/socket.h b/source4/lib/socket/socket.h
index 7a27e3070b..e9338127c4 100644
--- a/source4/lib/socket/socket.h
+++ b/source4/lib/socket/socket.h
@@ -21,6 +21,7 @@
#define _SAMBA_SOCKET_H
struct tevent_context;
+struct tevent_fd;
struct socket_context;
enum socket_type {
@@ -205,6 +206,11 @@ NTSTATUS socket_connect_multi(TALLOC_CTX *mem_ctx, const char *server_address,
void set_socket_options(int fd, const char *options);
void socket_set_flags(struct socket_context *socket, unsigned flags);
+void socket_tevent_fd_close_fn(struct tevent_context *ev,
+ struct tevent_fd *fde,
+ int fd,
+ void *private_data);
+
extern bool testnonblock;
#endif /* _SAMBA_SOCKET_H */