svn commit: samba r5292 - in branches/SAMBA_4_0/source/lib/events: .

tridge at samba.org tridge at samba.org
Thu Feb 10 03:16:34 GMT 2005


Author: tridge
Date: 2005-02-10 03:16:33 +0000 (Thu, 10 Feb 2005)
New Revision: 5292

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=5292

Log:
ensure we cleanup the epoll_fd on event context destruction


Modified:
   branches/SAMBA_4_0/source/lib/events/events.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/events/events.c
===================================================================
--- branches/SAMBA_4_0/source/lib/events/events.c	2005-02-10 01:19:26 UTC (rev 5291)
+++ branches/SAMBA_4_0/source/lib/events/events.c	2005-02-10 03:16:33 UTC (rev 5292)
@@ -113,6 +113,21 @@
 
 
 /*
+  destroy an event context
+*/
+static int event_context_destructor(void *ptr)
+{
+#if WITH_EPOLL
+	struct event_context *ev = talloc_get_type(ptr, struct event_context);
+	if (ev->epoll_fd != -1) {
+		close(ev->epoll_fd);
+		ev->epoll_fd = -1;
+	}
+#endif
+	return 0;
+}
+
+/*
   create a event_context structure. This must be the first events
   call, and all subsequent calls pass this event_context as the first
   element. Event handlers also receive this as their first argument.
@@ -128,6 +143,8 @@
 	ev->epoll_fd = epoll_create(64);
 #endif
 
+	talloc_set_destructor(ev, event_context_destructor);
+
 	return ev;
 }
 



More information about the samba-cvs mailing list