svn commit: samba r11607 - in branches/SAMBA_4_0/source/smb_server: .

tridge at samba.org tridge at samba.org
Wed Nov 9 13:42:58 GMT 2005


Author: tridge
Date: 2005-11-09 13:42:56 +0000 (Wed, 09 Nov 2005)
New Revision: 11607

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

Log:

switched the smb server to use the generic packet send code



Modified:
   branches/SAMBA_4_0/source/smb_server/request.c
   branches/SAMBA_4_0/source/smb_server/smb_server.c
   branches/SAMBA_4_0/source/smb_server/smb_server.h


Changeset:
Modified: branches/SAMBA_4_0/source/smb_server/request.c
===================================================================
--- branches/SAMBA_4_0/source/smb_server/request.c	2005-11-09 13:34:36 UTC (rev 11606)
+++ branches/SAMBA_4_0/source/smb_server/request.c	2005-11-09 13:42:56 UTC (rev 11607)
@@ -27,6 +27,7 @@
 #include "dlinklist.h"
 #include "smb_server/smb_server.h"
 #include "smbd/service_stream.h"
+#include "lib/stream/packet.h"
 
 
 /* we over allocate the data buffer to prevent too many realloc calls */
@@ -291,16 +292,19 @@
 */
 void req_send_reply_nosign(struct smbsrv_request *req)
 {
+	DATA_BLOB blob;
+	NTSTATUS status;
+
 	if (req->out.size > NBT_HDR_SIZE) {
 		_smb_setlen(req->out.buffer, req->out.size - NBT_HDR_SIZE);
 	}
 
-	/* add the request to the list of requests that need to be
-	   sent to the client, then mark the socket event structure
-	   ready for write events */
-	DLIST_ADD_END(req->smb_conn->pending_send, req, struct smbsrv_request *);
-
-	EVENT_FD_WRITEABLE(req->smb_conn->connection->event.fde);
+	blob = data_blob_const(req->out.buffer, req->out.size);
+	status = packet_send(req->smb_conn->packet, blob);
+	if (!NT_STATUS_IS_OK(status)) {
+		smbsrv_terminate_connection(req->smb_conn, nt_errstr(status));
+	}
+	req_destroy(req);
 }
 
 /*

Modified: branches/SAMBA_4_0/source/smb_server/smb_server.c
===================================================================
--- branches/SAMBA_4_0/source/smb_server/smb_server.c	2005-11-09 13:34:36 UTC (rev 11606)
+++ branches/SAMBA_4_0/source/smb_server/smb_server.c	2005-11-09 13:42:56 UTC (rev 11607)
@@ -620,47 +620,9 @@
 */
 static void smbsrv_send(struct stream_connection *conn, uint16_t flags)
 {
-	struct smbsrv_connection *smb_conn = talloc_get_type(conn->private, struct smbsrv_connection);
-
-	while (smb_conn->pending_send) {
-		struct smbsrv_request *req = smb_conn->pending_send;
-		DATA_BLOB blob;
-		NTSTATUS status;
-		size_t sendlen;
-
-		blob.data = req->out.buffer;
-		blob.length = req->out.size;
-
-		/* send as much of this request as we can */
-		status = socket_send(conn->socket, &blob, &sendlen, 0);
-		if (NT_STATUS_IS_ERR(status)) {
-			smbsrv_terminate_connection(req->smb_conn, nt_errstr(status));
-			break;
-		}
-		if (sendlen == 0) {
-			break;
-		}
-
-		req->out.buffer += sendlen;
-		req->out.size -= sendlen;
-
-		/* is the whole request gone? */
-		if (req->out.size == 0) {
-			DLIST_REMOVE(smb_conn->pending_send, req);
-			req_destroy(req);
-		}
-	}
-
-	if (smb_conn->terminate) {
-		stream_terminate_connection(smb_conn->connection, smb_conn->terminate);
-		return;
-	}
-
-	/* if no more requests are pending to be sent then
-	   we should stop select for write */
-	if (smb_conn->pending_send == NULL) {
-		EVENT_FD_NOT_WRITEABLE(conn->event.fde);
-	}
+	struct smbsrv_connection *smb_conn = talloc_get_type(conn->private, 
+							     struct smbsrv_connection);
+	packet_queue_run(smb_conn->packet);
 }
 
 

Modified: branches/SAMBA_4_0/source/smb_server/smb_server.h
===================================================================
--- branches/SAMBA_4_0/source/smb_server/smb_server.h	2005-11-09 13:34:36 UTC (rev 11606)
+++ branches/SAMBA_4_0/source/smb_server/smb_server.h	2005-11-09 13:42:56 UTC (rev 11607)
@@ -254,10 +254,6 @@
 	/* this holds a partially received request */
 	struct packet_context *packet;
 
-	/* this holds list of replies that are waiting to be sent
-	   to the client */
-	struct smbsrv_request *pending_send;
-
 	/* a list of partially received transaction requests */
 	struct smbsrv_trans_partial {
 		struct smbsrv_trans_partial *next, *prev;



More information about the samba-cvs mailing list