]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
drop any partialialy send packets when we get a socket write error
authorAndrew Tridgell <tridge@samba.org>
Sat, 26 May 2007 06:41:32 +0000 (16:41 +1000)
committerAndrew Tridgell <tridge@samba.org>
Sat, 26 May 2007 06:41:32 +0000 (16:41 +1000)
(This used to be ctdb commit 4f7b97af8e0075de56059fffc57a86cb0c16df46)

ctdb/common/ctdb_io.c

index 92cb5bbf2a142446337073a6bc611eb1762f45f1..c47a7e4b379fa846357155099d768bfb8b70b934 100644 (file)
@@ -40,6 +40,7 @@ struct ctdb_queue_pkt {
        struct ctdb_queue_pkt *next, *prev;
        uint8_t *data;
        uint32_t length;
+       uint32_t full_length;
 };
 
 struct ctdb_queue {
@@ -175,6 +176,11 @@ static void queue_io_write(struct ctdb_queue *queue)
                }
 
                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 @@ int ctdb_queue_send(struct ctdb_queue *queue, uint8_t *data, uint32_t length)
        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);