svn commit: samba r12337 - in trunk/source/nsswitch: .

gd at samba.org gd at samba.org
Mon Dec 19 02:18:10 GMT 2005


Author: gd
Date: 2005-12-19 02:18:09 +0000 (Mon, 19 Dec 2005)
New Revision: 12337

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

Log:
Add select() and timed_event infrastructure in the winbind child
process.

Guenther

Modified:
   trunk/source/nsswitch/winbindd_dual.c


Changeset:
Modified: trunk/source/nsswitch/winbindd_dual.c
===================================================================
--- trunk/source/nsswitch/winbindd_dual.c	2005-12-19 02:15:13 UTC (rev 12336)
+++ trunk/source/nsswitch/winbindd_dual.c	2005-12-19 02:18:09 UTC (rev 12337)
@@ -502,10 +502,42 @@
 	}
 	
 	while (1) {
+
+		int ret;
+		fd_set read_fds;
+		struct timeval t;
+		struct timeval *tp;
+		struct timeval now;
+
 		/* free up any talloc memory */
 		lp_talloc_free();
 		main_loop_talloc_free();
 
+		run_events();
+
+		GetTimeOfDay(&now);
+
+		tp = get_timed_events_timeout(&t, (time_t)-1);
+		if (tp) {
+			DEBUG(11,("select will use timeout of %d seconds\n", tp->tv_sec));
+		}
+
+		FD_ZERO(&read_fds);
+		FD_SET(state.sock, &read_fds);
+
+		ret = sys_select(state.sock + 1, &read_fds, NULL, NULL, tp);
+
+		if (ret == 0) {
+			DEBUG(10,("nothing is ready yet, continue\n"));
+			continue;
+		}
+
+		if (ret == -1 && errno != EINTR) {
+			DEBUG(0,("select error occured\n"));
+			perror("select");
+			return False;
+		}
+
 		/* fetch a request from the main daemon */
 		child_read_request(&state);
 



More information about the samba-cvs mailing list