svn commit: samba r12125 - in branches/SAMBA_4_0/source/smbd: .

metze at samba.org metze at samba.org
Thu Dec 8 09:13:29 GMT 2005


Author: metze
Date: 2005-12-08 09:13:28 +0000 (Thu, 08 Dec 2005)
New Revision: 12125

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

Log:
make the deferred connection termination the default,
so that I can remove all the other versions of it

metze
Modified:
   branches/SAMBA_4_0/source/smbd/service_stream.c
   branches/SAMBA_4_0/source/smbd/service_stream.h


Changeset:
Modified: branches/SAMBA_4_0/source/smbd/service_stream.c
===================================================================
--- branches/SAMBA_4_0/source/smbd/service_stream.c	2005-12-08 08:48:35 UTC (rev 12124)
+++ branches/SAMBA_4_0/source/smbd/service_stream.c	2005-12-08 09:13:28 UTC (rev 12125)
@@ -55,7 +55,24 @@
 {
 	struct event_context *event_ctx = srv_conn->event.ctx;
 	const struct model_ops *model_ops = srv_conn->model_ops;
+
+	if (!reason) reason = "unknwon reason";
+
+	srv_conn->terminate = reason;
+
+	if (srv_conn->processing) {
+		/* 
+		 * if we're currently inside the stream_io_handler(),
+		 * deferr the termination to the end of stream_io_hendler()
+		 *
+		 * and we don't want to read or write to the connection...
+		 */
+		event_set_fd_flags(srv_conn->event.fde, 0);
+		return;
+	}
+
 	talloc_free(srv_conn->event.fde);
+	srv_conn->event.fde = NULL;
 	talloc_free(srv_conn);
 	model_ops->terminate(event_ctx, reason);
 }
@@ -68,13 +85,17 @@
 {
 	struct stream_connection *conn = talloc_get_type(private, 
 							 struct stream_connection);
+
+	conn->processing = True;
 	if (flags & EVENT_FD_WRITE) {
 		conn->ops->send_handler(conn, flags);
-		return;
+	} else if (flags & EVENT_FD_READ) {
+		conn->ops->recv_handler(conn, flags);
 	}
+	conn->processing = False;
 
-	if (flags & EVENT_FD_READ) {
-		conn->ops->recv_handler(conn, flags);
+	if (conn->terminate) {
+		stream_terminate_connection(conn, conn->terminate);
 	}
 }
 

Modified: branches/SAMBA_4_0/source/smbd/service_stream.h
===================================================================
--- branches/SAMBA_4_0/source/smbd/service_stream.h	2005-12-08 08:48:35 UTC (rev 12124)
+++ branches/SAMBA_4_0/source/smbd/service_stream.h	2005-12-08 09:13:28 UTC (rev 12125)
@@ -23,10 +23,10 @@
 
 /* modules can use the following to determine if the interface has changed
  * please increment the version number after each interface change
- * with a comment and maybe update struct process_model_critical_sizes.
+ * with a comment and maybe update struct stream_connection_critical_sizes.
  */
-/* version 1 - initial version - metze */
-#define SERVER_SERVICE_VERSION 1
+/* version 0 - initial version - metze */
+#define SERVER_SERVICE_VERSION 0
 
 /*
   top level context for an established stream connection
@@ -44,6 +44,9 @@
 
 	struct socket_context *socket;
 	struct messaging_context *msg_ctx;
+
+	BOOL processing;
+	const char *terminate;
 };
 
 



More information about the samba-cvs mailing list