gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r13771 - gnunet/src/core


From: gnunet
Subject: [GNUnet-SVN] r13771 - gnunet/src/core
Date: Mon, 22 Nov 2010 22:10:36 +0100

Author: grothoff
Date: 2010-11-22 22:10:36 +0100 (Mon, 22 Nov 2010)
New Revision: 13771

Modified:
   gnunet/src/core/core_api.c
Log:
fixing various issues Nate had: ready queue simply must be purged on reconnect

Modified: gnunet/src/core/core_api.c
===================================================================
--- gnunet/src/core/core_api.c  2010-11-22 21:02:28 UTC (rev 13770)
+++ gnunet/src/core/core_api.c  2010-11-22 21:10:36 UTC (rev 13771)
@@ -463,6 +463,7 @@
 reconnect_later (struct GNUNET_CORE_Handle *h)
 {
   struct ControlMessage *cm;
+  struct PeerRecord *pr;
 
   while (NULL != (cm = h->pending_head))
     {
@@ -484,6 +485,11 @@
                                             &disconnect_and_free_peer_entry,
                                             h);
     }
+  while (NULL != (pr = h->ready_peer_head))    
+    GNUNET_CONTAINER_DLL_remove (h->ready_peer_head,
+                                h->ready_peer_tail,
+                                pr);
+  
   GNUNET_assert (h->pending_head == NULL);
   h->currently_down = GNUNET_YES;
   GNUNET_assert (h->reconnect_task == GNUNET_SCHEDULER_NO_TASK);
@@ -664,12 +670,7 @@
   /* now check for 'ready' P2P messages */
   if (NULL != (pr = h->ready_peer_head))
     {
-      /* FIXME: If a reconnect_later call happened, this can be NULL! */
-      if (pr->pending_head == NULL)
-        {
-          GNUNET_break(0);
-          return 0;
-        }
+      GNUNET_assert (pr->pending_head != NULL);
       th = pr->pending_head;
       if (size < th->msize + sizeof (struct SendMessage))
        {
@@ -769,7 +770,7 @@
     }
   if (h->pending_head != NULL)
     msize = ntohs (((struct GNUNET_MessageHeader*) 
&h->pending_head[1])->size);    
-  else if ((h->ready_peer_head != NULL) && (h->ready_peer_head->pending_head 
!= NULL)) /* FIXME: h->ready_peer_head->pending_head check necessary? */
+  else if (h->ready_peer_head != NULL) 
     msize = h->ready_peer_head->pending_head->msize + sizeof (struct 
SendMessage);    
   else
     {
@@ -1133,7 +1134,7 @@
 #endif
       if (pr->pending_head == NULL)
         {
-         /* request must have been cancelled between the origional request
+         /* request must have been cancelled between the original request
             and the response from core, ignore core's readiness */
           return;
         }
@@ -1518,22 +1519,14 @@
 
   /* Order entries by deadline, but SKIP 'HEAD' if
      we're in the 'ready_peer_*' DLL */
-  /* FIXME: again, pr->pending_head is NULL after a reconnect_later call */
   pos = pr->pending_head;
-  if (pr->pending_head != NULL)
+  if ( (pr->prev != NULL) ||
+       (pr->next != NULL) ||
+       (pr == handle->ready_peer_head) )
     {
-      if ( (pr->prev != NULL) ||
-           (pr->next != NULL) ||
-           (pr == handle->ready_peer_head) )
-        {
-          GNUNET_assert (pos != NULL);
-          pos = pos->next; /* skip head */
-        }
+      GNUNET_assert (pos != NULL);
+      pos = pos->next; /* skip head */
     }
-  else
-    {
-      GNUNET_break(0);
-    }
 
   /* insertion sort */
   prev = pos;




reply via email to

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