Rev 353: drop any partialialy send packets when we get a socket write error in http://samba.org/~tridge/ctdb

tridge at samba.org tridge at samba.org
Sat May 26 06:41:34 GMT 2007


------------------------------------------------------------
revno: 353
revision-id: tridge at samba.org-20070526064132-e3rizx7rz3bkj5ra
parent: tridge at samba.org-20070526063541-ejidxmkfrpxmu0hz
committer: Andrew Tridgell <tridge at samba.org>
branch nick: tridge
timestamp: Sat 2007-05-26 16:41:32 +1000
message:
  drop any partialialy send packets when we get a socket write error
modified:
  common/ctdb_io.c               ctdb_io.c-20070409200335-dzfc7f3rra5rcf60-1
=== modified file 'common/ctdb_io.c'
--- a/common/ctdb_io.c	2007-05-26 04:46:12 +0000
+++ b/common/ctdb_io.c	2007-05-26 06:41:32 +0000
@@ -40,6 +40,7 @@
 	struct ctdb_queue_pkt *next, *prev;
 	uint8_t *data;
 	uint32_t length;
+	uint32_t full_length;
 };
 
 struct ctdb_queue {
@@ -175,6 +176,11 @@
 		}
 
 		if (n == -1 && errno != EAGAIN && errno != EWOULDBLOCK) {
+			if (pkt->length != pkt->full_length) {
+				/* partial packet sent - we have to drop it */
+				DLIST_REMOVE(queue->out_queue, pkt);
+				talloc_free(pkt);
+			}
 			talloc_free(queue->fde);
 			queue->fde = NULL;
 			queue->fd = -1;
@@ -262,6 +268,7 @@
 	CTDB_NO_MEMORY(queue->ctdb, pkt->data);
 
 	pkt->length = length2;
+	pkt->full_length = length2;
 
 	if (queue->out_queue == NULL && queue->fd != -1) {
 		EVENT_FD_WRITEABLE(queue->fde);



More information about the samba-cvs mailing list