summaryrefslogtreecommitdiff
path: root/source4/smbd
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-01-23 12:17:45 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:09:08 -0500
commit6c14b0133dede38294a812be7f5f5bd5ec3d498b (patch)
tree6b60ad912d6ff06e1624580ba6e8cbeda3341d1b /source4/smbd
parentfd62df64188c0f992876c72fdda8a6da5dba3090 (diff)
downloadsamba-6c14b0133dede38294a812be7f5f5bd5ec3d498b.tar.gz
samba-6c14b0133dede38294a812be7f5f5bd5ec3d498b.tar.bz2
samba-6c14b0133dede38294a812be7f5f5bd5ec3d498b.zip
r4944: every event_add_*() caller was having to call talloc_steal() to take
control of the event, so instead build that into the function. If you pass NULL as mem_ctx then it leaves it as a child of the events structure. (This used to be commit 7f981b9ed96f39027cbfd500f41e0c2be64cbb50)
Diffstat (limited to 'source4/smbd')
-rw-r--r--source4/smbd/service.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/source4/smbd/service.c b/source4/smbd/service.c
index 7067a26e7a..378ca1914d 100644
--- a/source4/smbd/service.c
+++ b/source4/smbd/service.c
@@ -163,15 +163,14 @@ struct server_stream_socket *service_setup_stream_socket(struct server_service *
stream_socket->service = service;
stream_socket->socket = sock;
stream_socket->event.ctx = service->server->event.ctx;
- stream_socket->event.fde = event_add_fd(stream_socket->event.ctx, &fde);
+ stream_socket->event.fde = event_add_fd(stream_socket->event.ctx,
+ &fde, stream_socket);
if (!stream_socket->event.fde) {
- DEBUG(0,("event_add_fd(stream_socket->event.ctx, &fde) failed\n"));
socket_destroy(sock);
return NULL;
}
talloc_steal(stream_socket, sock);
- talloc_steal(stream_socket, stream_socket->event.fde);
if (stream_socket->stream.ops->socket_init) {
stream_socket->stream.ops->socket_init(stream_socket);
@@ -239,11 +238,8 @@ struct server_connection *server_setup_connection(struct event_context *ev,
stream_socket->stream.ops->accept_connection(srv_conn);
/* accpect_connection() of the service may changed idle.next_event */
- srv_conn->event.fde = event_add_fd(ev,&fde);
- srv_conn->event.idle = event_add_timed(ev,&idle);
-
- talloc_steal(srv_conn, srv_conn->event.fde);
- talloc_steal(srv_conn, srv_conn->event.idle);
+ srv_conn->event.fde = event_add_fd(ev, &fde, srv_conn);
+ srv_conn->event.idle = event_add_timed(ev, &idle, srv_conn);
talloc_set_destructor(srv_conn, server_connection_destructor);