code cleanup, set status to DOWN after connection goes DOWN, otherwise we generate...
authorChristian Grothoff <christian@grothoff.org>
Thu, 18 Nov 2010 21:52:39 +0000 (21:52 +0000)
committerChristian Grothoff <christian@grothoff.org>
Thu, 18 Nov 2010 21:52:39 +0000 (21:52 +0000)
src/core/gnunet-service-core.c

index b3ef1cad946f8a866d1352f928fea5a9c1abd44b..5c2300bda4da13e41f9ed6d29b8949a94715c31c 100644 (file)
@@ -2739,17 +2739,16 @@ notify_transport_connect_done (void *cls, size_t size, void *buf)
 {
   struct Neighbour *n = cls;
 
 {
   struct Neighbour *n = cls;
 
+  n->th = NULL;
   if (GNUNET_YES != n->is_connected)
     {
       /* transport should only call us to transmit a message after
        * telling us about a successful connection to the respective peer */
   if (GNUNET_YES != n->is_connected)
     {
       /* transport should only call us to transmit a message after
        * telling us about a successful connection to the respective peer */
-      n->th = NULL; /* If this happens because of a timeout, reset n-th so another message may be sent for this peer! */
 #if DEBUG_CORE
       GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Timeout on notify connect!\n");
 #endif
       return 0;
     }
 #if DEBUG_CORE
       GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Timeout on notify connect!\n");
 #endif
       return 0;
     }
-  n->th = NULL;
   if (buf == NULL)
     {
       GNUNET_log (GNUNET_ERROR_TYPE_INFO,
   if (buf == NULL)
     {
       GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -4182,6 +4181,7 @@ handle_transport_notify_disconnect (void *cls,
       send_to_all_clients (&cnm.header, GNUNET_NO, GNUNET_CORE_OPTION_SEND_DISCONNECT);
     }
   n->is_connected = GNUNET_NO;
       send_to_all_clients (&cnm.header, GNUNET_NO, GNUNET_CORE_OPTION_SEND_DISCONNECT);
     }
   n->is_connected = GNUNET_NO;
+  n->status = PEER_STATE_DOWN;
   while (NULL != (car = n->active_client_request_head))
     {
       GNUNET_CONTAINER_DLL_remove (n->active_client_request_head,
   while (NULL != (car = n->active_client_request_head))
     {
       GNUNET_CONTAINER_DLL_remove (n->active_client_request_head,