]> git.proxmox.com Git - mirror_kronosnet.git/commitdiff
host: Remove host_tail as it's not used.
authorChristine Caulfield <ccaulfie@redhat.com>
Mon, 16 Jan 2017 14:50:17 +0000 (14:50 +0000)
committerChristine Caulfield <ccaulfie@redhat.com>
Mon, 16 Jan 2017 14:50:17 +0000 (14:50 +0000)
it also had a bug which could cause knet to crash after a host was
removed.

This patch puts new nodes at the front of the list rather than at the
end, but I don't think this is a problem.

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
libknet/host.c
libknet/internals.h

index 8c74009efd4e53fef99c3f3f2e2bcd6dd1daf53c..8c44007558e8b9c25c9714c4ad4dc2afe14e4126 100644 (file)
@@ -93,13 +93,10 @@ int knet_host_add(knet_handle_t knet_h, uint16_t host_id)
        /*
         * add new host to host list
         */
-       if (!knet_h->host_head) {
-               knet_h->host_head = host;
-               knet_h->host_tail = host;
-       } else {
-               knet_h->host_tail->next = host;
-               knet_h->host_tail = host;
+       if (knet_h->host_head) {
+               host->next = knet_h->host_head;
        }
+       knet_h->host_head = host;
 
        _host_list_update(knet_h);
 
index 73f847b29a83c5df523e29860a39cb2952de6ed6..2d114704098055d51b67571277791b8076425afb 100644 (file)
@@ -141,7 +141,6 @@ struct knet_handle {
        unsigned int data_mtu;  /* contains the max data size that we can send onwire
                                 * without frags */
        struct knet_host *host_head;
-       struct knet_host *host_tail;
        struct knet_host *host_index[KNET_MAX_HOST];
        knet_transport_t transports[KNET_MAX_TRANSPORTS+1];
        struct knet_transport_ops *transport_ops[KNET_MAX_TRANSPORTS+1];