gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r11440 - gnunet/src/datastore


From: gnunet
Subject: [GNUnet-SVN] r11440 - gnunet/src/datastore
Date: Wed, 19 May 2010 23:23:08 +0200

Author: grothoff
Date: 2010-05-19 23:23:08 +0200 (Wed, 19 May 2010)
New Revision: 11440

Modified:
   gnunet/src/datastore/datastore_api.c
Log:
fixing reconnect issues

Modified: gnunet/src/datastore/datastore_api.c
===================================================================
--- gnunet/src/datastore/datastore_api.c        2010-05-19 20:20:52 UTC (rev 
11439)
+++ gnunet/src/datastore/datastore_api.c        2010-05-19 21:23:08 UTC (rev 
11440)
@@ -621,18 +621,25 @@
   const struct StatusMessage *sm;
   const char *emsg;
   int32_t status;
+  int was_transmitted;
 
-  free_queue_entry (qe);
+  was_transmitted = qe->was_transmitted;
   if (msg == NULL)
     {      
+      free_queue_entry (qe);
       if (NULL == h->client)
        return; /* forced disconnect */
-      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                 _("Failed to receive response from database.\n"));
-      do_disconnect (h);
+      if (was_transmitted == GNUNET_YES)
+       {
+         GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                     _("Failed to receive response from database.\n"));
+         do_disconnect (h);
+       }
       return;
     }
-
+  GNUNET_assert (GNUNET_YES == qe->was_transmitted);
+  GNUNET_assert (h->queue_head == qe);
+  free_queue_entry (qe);
   if ( (ntohs(msg->size) < sizeof(struct StatusMessage)) ||
        (ntohs(msg->type) != GNUNET_MESSAGE_TYPE_DATASTORE_STATUS) ) 
     {
@@ -1017,14 +1024,14 @@
 
   if (msg == NULL)
     {
-#if DEBUG_DATASTORE
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                 "Failed to receive response from datastore or queue full\n");
-#endif
       was_transmitted = qe->was_transmitted;
       free_queue_entry (qe);
-      if (GNUNET_YES == was_transmitted)       
-       do_disconnect (h);
+      if (was_transmitted == GNUNET_YES)
+       {
+         GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                     _("Failed to receive response from database.\n"));
+         do_disconnect (h);
+       }
       if (rc.iter != NULL)
        rc.iter (rc.iter_cls,
                 NULL, 0, NULL, 0, 0, 0, 
@@ -1254,11 +1261,12 @@
   if (GNUNET_YES == qe->was_transmitted) 
     {
       if (qe->response_proc == &process_result_message)        
-       qe->qc.rc.iter = NULL;    
-      else
-       reconnect = GNUNET_YES;
+       {
+         qe->qc.rc.iter = NULL;    
+         return;
+       }
+      reconnect = GNUNET_YES;
     }
-
   free_queue_entry (qe);
   h->queue_size--;
   if (reconnect)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]