summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/smbd/service_stream.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/source4/smbd/service_stream.c b/source4/smbd/service_stream.c
index f3f3a67e78..39c7dda227 100644
--- a/source4/smbd/service_stream.c
+++ b/source4/smbd/service_stream.c
@@ -289,9 +289,13 @@ NTSTATUS stream_setup_socket(struct event_context *event_context,
return status;
}
+ /* we will close the socket using the events system */
+ socket_set_flags(stream_socket->sock, SOCKET_FLAG_NOCLOSE);
+
event_add_fd(event_context, stream_socket->sock,
socket_get_fd(stream_socket->sock),
- EVENT_FD_READ, stream_accept_handler, stream_socket);
+ EVENT_FD_READ|EVENT_FD_AUTOCLOSE,
+ stream_accept_handler, stream_socket);
stream_socket->private = talloc_reference(stream_socket, private);
stream_socket->ops = stream_ops;