]> granicus.if.org Git - neomutt/commitdiff
conn: let mutt_socket_new add Connection to the list
authorDamien Riegel <damien.riegel@gmail.com>
Wed, 8 Nov 2017 20:48:44 +0000 (15:48 -0500)
committerRichard Russon <rich@flatcap.org>
Thu, 12 Apr 2018 08:51:56 +0000 (09:51 +0100)
mutt_socket_new is followed by a call to TAILQ_INSERT_HEAD; and
mutt_socket_free takes care of removing the Connection from the
Connection list. Make these two more in pair by making mutt_socket_new
adds the newly created Connection to the connection list.

conn/socket.c
mutt_socket.c

index 8f7b384e276dd9fee971b2928a157a6d10917d5a..f33bce79892d2f96b72f653556c7e92898c317ec 100644 (file)
@@ -342,6 +342,8 @@ struct Connection *mutt_socket_new(void)
   struct Connection *conn = mutt_mem_calloc(1, sizeof(struct Connection));
   conn->fd = -1;
 
+  TAILQ_INSERT_HEAD(&Connections, conn, entries);
+
   return conn;
 }
 
index 28b4799c27bd958f410e12412039663f08d94841..8946a402fa1fc6f9d3cf6c4475b284bec403a544 100644 (file)
@@ -69,8 +69,6 @@ struct Connection *mutt_conn_find(const struct Connection *start, const struct A
   conn = mutt_socket_new();
   memcpy(&conn->account, account, sizeof(struct Account));
 
-  TAILQ_INSERT_HEAD(&Connections, conn, entries);
-
   if (Tunnel && *Tunnel)
     mutt_tunnel_socket_setup(conn);
   else if (account->flags & MUTT_ACCT_SSL)