]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
merged from samba4 ctdb
authorAndrew Tridgell <tridge@samba.org>
Wed, 7 Feb 2007 02:26:07 +0000 (13:26 +1100)
committerAndrew Tridgell <tridge@samba.org>
Wed, 7 Feb 2007 02:26:07 +0000 (13:26 +1100)
(This used to be ctdb commit 677fd2a7758b743ea920d0b3adb85fbb3f1ff49e)

ctdb/common/ctdb.c
ctdb/tcp/tcp_io.c

index 94715f622698761201ee3522b81d0a32e2eafba1..ecef14bca413d44c2c08c76f94160ea0b86fa15f 100644 (file)
@@ -175,6 +175,7 @@ int ctdb_start(struct ctdb_context *ctdb)
 static void ctdb_recv_pkt(struct ctdb_context *ctdb, uint8_t *data, uint32_t length)
 {
        struct ctdb_req_header *hdr;
+
        if (length < sizeof(*hdr)) {
                ctdb_set_error(ctdb, "Bad packet length %d\n", length);
                return;
@@ -229,7 +230,7 @@ static void ctdb_node_dead(struct ctdb_node *node)
 }
 
 /*
-  called by the transport layer when a node is dead
+  called by the transport layer when a node is connected
 */
 static void ctdb_node_connected(struct ctdb_node *node)
 {
index 5385ad7f46d454c4a1326c68300059ba673f1d8c..e59f6167ff8a15798b9eb53ed3c9a08571e51f59 100644 (file)
@@ -38,13 +38,6 @@ static void ctdb_tcp_node_dead(struct event_context *ev, struct timed_event *te,
        struct ctdb_tcp_node *tnode = talloc_get_type(node->private, 
                                                      struct ctdb_tcp_node);
 
-       /* flush the queue */
-       while (tnode->queue) {
-               struct ctdb_tcp_packet *pkt = tnode->queue;
-               DLIST_REMOVE(tnode->queue, pkt);
-               talloc_free(pkt);
-       }
-
        /* start a new connect cycle to try to re-establish the
           link */
        talloc_free(tnode->fde);
@@ -68,6 +61,7 @@ void ctdb_tcp_node_write(struct event_context *ev, struct fd_event *fde,
                   always an error, as we have separate read and write
                   sockets. In future we may combine them, but for now it must
                   mean that the socket is dead, so we try to reconnect */
+               node->ctdb->upcalls->node_dead(node);
                talloc_free(tnode->fde);
                close(tnode->fd);
                tnode->fd = -1;
@@ -170,10 +164,9 @@ void ctdb_tcp_incoming_read(struct event_context *ev, struct fd_event *fde,
                in->ctdb->upcalls->recv_pkt(in->ctdb, d2, len);
                data += len;
                nread -= len;           
-               return;
        }
 
-       if (nread < 4 || *(uint32_t *)data > nread) {
+       if (nread > 0) {
                /* we have only part of a packet */
                if (data_base == data) {
                        in->partial.data = data;