From 6591a226144d371a6b68fc5e7201a90a77dc9153 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 17 Oct 2004 10:04:49 +0000 Subject: r3016: - converted the events code to talloc - added the new messaging system, based on unix domain sockets. It gets over 10k messages/second on my laptop without any socket cacheing, which is better than I expected. - added a LOCAL-MESSAGING torture test (This used to be commit 3af06478da7ab34a272226d8d9ac87e0a4940cfb) --- source4/lib/socket/socket_unix.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source4/lib/socket/socket_unix.c') diff --git a/source4/lib/socket/socket_unix.c b/source4/lib/socket/socket_unix.c index d87eaf49c4..7e169c47a7 100644 --- a/source4/lib/socket/socket_unix.c +++ b/source4/lib/socket/socket_unix.c @@ -29,6 +29,7 @@ static NTSTATUS unixdom_init(struct socket_context *sock) if (sock->fd == -1) { return NT_STATUS_INSUFFICIENT_RESOURCES; } + sock->private_data = NULL; return NT_STATUS_OK; } @@ -36,6 +37,11 @@ static NTSTATUS unixdom_init(struct socket_context *sock) static void unixdom_close(struct socket_context *sock) { close(sock->fd); + /* if we were listening, then don't leave the socket lying + around in the filesystem */ + if (sock->private_data) { + unlink((const char *)sock->private_data); + } } static NTSTATUS unixdom_connect(struct socket_context *sock, @@ -82,6 +88,9 @@ static NTSTATUS unixdom_listen(struct socket_context *sock, return NT_STATUS_INVALID_PARAMETER; } + /* delete if it already exists */ + unlink(my_address); + ZERO_STRUCT(my_addr); my_addr.sun_family = AF_UNIX; strncpy(my_addr.sun_path, my_address, sizeof(my_addr.sun_path)); @@ -104,6 +113,7 @@ static NTSTATUS unixdom_listen(struct socket_context *sock, } sock->state = SOCKET_STATE_SERVER_LISTEN; + sock->private_data = (void *)talloc_strdup(sock, my_address); return NT_STATUS_OK; } -- cgit