-must notify client on timeout
[oweals/gnunet.git] / src / identity / identity_api.c
index 38c9efdd4be217461186e47b3a21750431a81902..3028ff3fd4ef1df4e7e34a89d1091cd37bcd56c1 100644 (file)
@@ -87,19 +87,19 @@ struct GNUNET_IDENTITY_Operation
   const struct GNUNET_MessageHeader *msg;
 
   /**
-   * Continuation to invoke with the result of the transmission; 'cb'
+   * Continuation to invoke with the result of the transmission; @e cb
    * will be NULL in this case.
    */
   GNUNET_IDENTITY_Continuation cont;
 
   /**
    * Continuation to invoke with the result of the transmission for
-   * 'get' operations ('cont' will be NULL in this case).
+   * 'get' operations (@e cont will be NULL in this case).
    */
   GNUNET_IDENTITY_Callback cb;
 
   /**
-   * Closure for 'cont' or 'cb'.
+   * Closure for @e cont or @e cb.
    */
   void *cls;
 
@@ -418,6 +418,14 @@ message_handler (void *cls,
       return;
     }
     op = h->op_head;
+    if (NULL == op)
+    {
+      GNUNET_break (0);
+      reschedule_connect (h);
+      return;
+    }
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Received SET_DEFAULT message from identity service\n");
     GNUNET_CONTAINER_DLL_remove (h->op_head,
                                 h->op_tail,
                                 op);
@@ -889,6 +897,8 @@ GNUNET_IDENTITY_cancel (struct GNUNET_IDENTITY_Operation *op)
        (NULL == h->client) )
   {
     /* request not active, can simply remove */
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Client aborted non-head operation, simply removing it\n");
     GNUNET_CONTAINER_DLL_remove (h->op_head,
                                 h->op_tail,
                                 op);
@@ -898,6 +908,8 @@ GNUNET_IDENTITY_cancel (struct GNUNET_IDENTITY_Operation *op)
   if (NULL != h->th)
   {
     /* request active but not yet with service, can still abort */
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Client aborted head operation prior to transmission, aborting it\n");
     GNUNET_CLIENT_notify_transmit_ready_cancel (h->th);
     h->th = NULL;
     GNUNET_CONTAINER_DLL_remove (h->op_head,
@@ -908,6 +920,8 @@ GNUNET_IDENTITY_cancel (struct GNUNET_IDENTITY_Operation *op)
     return;
   }
   /* request active with service, simply ensure continuations are not called */
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Client aborted active request, NULLing continuation\n");
   op->cont = NULL;
   op->cb = NULL;
 }
@@ -970,9 +984,9 @@ GNUNET_IDENTITY_disconnect (struct GNUNET_IDENTITY_Handle *h)
     GNUNET_CONTAINER_multihashmap_destroy (h->egos);
     h->egos = NULL;
   }
-  GNUNET_break (NULL == h->op_head);
   while (NULL != (op = h->op_head))
   {
+    GNUNET_break (NULL == op->cont);
     GNUNET_CONTAINER_DLL_remove (h->op_head,
                                 h->op_tail,
                                 op);