Check for disconncting/disconnected socket in lookup/HB routines.
authorPekka Riikonen <priikone@silcnet.org>
Sun, 24 Aug 2003 11:35:39 +0000 (11:35 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Sun, 24 Aug 2003 11:35:39 +0000 (11:35 +0000)
lib/silcutil/silcsockconn.c

index 6817c5daea20f98150f7c52b3e9f4a696bc97e3e..a49422487a0329c1262989edbe2ff790fce95248 100644 (file)
@@ -103,6 +103,10 @@ SILC_TASK_CALLBACK(silc_socket_heartbeat)
   if (!hb->heartbeat)
     return;
 
+  if (SILC_IS_DISCONNECTING(hb->sock) ||
+      SILC_IS_DISCONNECTED(hb->sock))
+    return;
+
   if (hb->hb_callback)
     hb->hb_callback(hb->sock, hb->hb_context);
 
@@ -250,6 +254,10 @@ void silc_socket_host_lookup(SilcSocketConnection sock,
 
   SILC_LOG_DEBUG(("Performing async host lookup"));
 
+  if (SILC_IS_DISCONNECTING(sock) ||
+      SILC_IS_DISCONNECTED(sock))
+    return;
+
   lookup = silc_calloc(1, sizeof(*lookup));
   lookup->sock = silc_socket_dup(sock);        /* Increase reference counter */
   lookup->callback = callback;