svn commit: samba r16134 - in branches/tmp/vl-messaging/source/smbd: .

ab at samba.org ab at samba.org
Sat Jun 10 08:29:26 GMT 2006


Author: ab
Date: 2006-06-10 08:29:25 +0000 (Sat, 10 Jun 2006)
New Revision: 16134

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

Log:
Missing part of messaging rewrite by Aleksey Fedoseev <fedoseev at ru.ibm.com>
Modified:
   branches/tmp/vl-messaging/source/smbd/process.c
   branches/tmp/vl-messaging/source/smbd/server.c


Changeset:
Modified: branches/tmp/vl-messaging/source/smbd/process.c
===================================================================
--- branches/tmp/vl-messaging/source/smbd/process.c	2006-06-10 08:28:18 UTC (rev 16133)
+++ branches/tmp/vl-messaging/source/smbd/process.c	2006-06-10 08:29:25 UTC (rev 16134)
@@ -351,7 +351,7 @@
 
 static BOOL receive_message_or_smb(char *buffer, int buffer_len, int timeout)
 {
-	fd_set fds;
+	fd_set fds, wfds;
 	int selrtn;
 	struct timeval to;
 	int maxfd = 0;
@@ -415,10 +415,11 @@
 	}
 
 	/*
-	 * Setup the select read fd set.
+	 * Setup select read and write fd sets.
 	 */
 
 	FD_ZERO(&fds);
+	FD_ZERO(&wfds);
 
 	/*
 	 * Ensure we process oplock break messages by preference.
@@ -462,7 +463,9 @@
 	maxfd = select_on_fd(change_notify_fd(), maxfd, &fds);
 	maxfd = select_on_fd(oplock_notify_fd(), maxfd, &fds);
 
-	selrtn = sys_select(maxfd+1,&fds,NULL,NULL,&to);
+	message_select_setup(&maxfd, &fds, &wfds);
+	
+	selrtn = sys_select(maxfd+1,&fds,&wfds,NULL,&to);
 
 	/* if we get EINTR then maybe we have received an oplock
 	   signal - treat this as select returning 1. This is ugly, but
@@ -491,6 +494,12 @@
 		return False;
 	}
 
+	/* Only messaging events - return timeout */
+	if(message_receive(&fds, &wfds) == selrtn) {
+		smb_read_error = READ_TIMEOUT;
+		return False;		
+	}
+
 	/*
 	 * Ensure we process oplock break messages by preference.
 	 * This is IMPORTANT ! Otherwise we can starve other processes

Modified: branches/tmp/vl-messaging/source/smbd/server.c
===================================================================
--- branches/tmp/vl-messaging/source/smbd/server.c	2006-06-10 08:28:18 UTC (rev 16133)
+++ branches/tmp/vl-messaging/source/smbd/server.c	2006-06-10 08:29:25 UTC (rev 16134)
@@ -383,7 +383,7 @@
 	   for each incoming connection */
 	DEBUG(2,("waiting for a connection\n"));
 	while (1) {
-		fd_set lfds;
+		fd_set lfds, wfds;
 		int num;
 		
 		/* Free up temporary memory from the main smbd. */
@@ -394,8 +394,11 @@
 
 		memcpy((char *)&lfds, (char *)&listen_set, 
 		       sizeof(listen_set));
+		FD_ZERO(&wfds);
+
+		message_select_setup(&maxfd, &lfds, &wfds);
 		
-		num = sys_select(maxfd+1,&lfds,NULL,NULL,NULL);
+		num = sys_select(maxfd+1,&lfds,&wfds,NULL,NULL);
 		
 		if (num == -1 && errno == EINTR) {
 			if (got_sig_term) {
@@ -412,6 +415,9 @@
 
 			continue;
 		}
+
+		/* don't process messaging sockets twice */
+		num -= message_receive(&lfds, &wfds);
 		
 		/* check if we need to reload services */
 		check_reload(time(NULL));
@@ -480,6 +486,8 @@
 					DEBUG(0,("tdb_reopen_all failed.\n"));
 					smb_panic("tdb_reopen_all failed.");
 				}
+				/* We should reinitialize messaging socket */
+				message_reinit();
 
 				return True; 
 			}
@@ -647,6 +655,7 @@
 
 	locking_end();
 	printing_end();
+	message_end();
 
 	if (how != SERVER_EXIT_NORMAL) {
 		int oldlevel = DEBUGLEVEL;



More information about the samba-cvs mailing list