-this should fix #3228 (communicate conversation/reconnect errors to client)
authorChristian Grothoff <christian@grothoff.org>
Fri, 20 Dec 2013 21:36:24 +0000 (21:36 +0000)
committerChristian Grothoff <christian@grothoff.org>
Fri, 20 Dec 2013 21:36:24 +0000 (21:36 +0000)
src/conversation/conversation_api_call.c
src/conversation/gnunet-conversation.c
src/include/gnunet_conversation_service.h

index 418af0b7327916cc810ad755fdab0fbc61096824..16173a4fbe44d9487a62e241c0c9901841b903c9 100644 (file)
@@ -416,6 +416,8 @@ handle_gns_response (void *cls,
   struct GNUNET_MQ_Envelope *e;
   struct ClientCallMessage *ccm;
 
+  GNUNET_break (NULL != call->gns_lookup);
+  GNUNET_break (CS_LOOKUP == call->gns_lookup);
   call->gns_lookup = NULL;
   for (i=0;i<rd_count;i++)
   {
@@ -516,8 +518,10 @@ reconnect_call (struct GNUNET_CONVERSATION_Call *call)
   }
   call->state = CS_SHUTDOWN;
   call->client = GNUNET_CLIENT_connect ("conversation", call->cfg);
-  if (NULL == call->client)
+  if (NULL == call->client);
     return;
+  call->event_handler (call->event_handler_cls,
+                       GNUNET_CONVERSATION_EC_CALL_ERROR);
   call->mq = GNUNET_MQ_queue_for_connection_client (call->client,
                                                     handlers,
                                                     &call_error_handler,
index b81743933ca765b544b6c4a703682acd1c5f5bc8..a042629cc86be1a29f176871376aa403eecbcd92 100644 (file)
@@ -411,6 +411,11 @@ call_event_handler (void *cls,
              _("Connection to `%s' resumed (by other user)\n"),
              peer_name);
     break;
+  case GNUNET_CONVERSATION_EC_CALL_ERROR:
+    FPRINTF (stdout,
+             _("Error with the call, restarting it\n"));
+    call_state = CS_RESOLVING;
+    break;
   }
 }
 
index cfe4a64ba22a6b79a76f1d07d590019e16e99120..c610dd0bd816ad008eb79ce5d49ed485cd0e2d7d 100644 (file)
@@ -333,7 +333,14 @@ enum GNUNET_CONVERSATION_CallEventCode
    * both sides can independently suspend and resume calls; a call is
    * only "working" of both sides are active.
    */
-  GNUNET_CONVERSATION_EC_CALL_RESUMED
+  GNUNET_CONVERSATION_EC_CALL_RESUMED,
+
+  /**
+   * We had an error handing the call, and are now restarting it
+   * (back to lookup).  This happens, for example, if the peer
+   * is restarted during a call.
+   */
+  GNUNET_CONVERSATION_EC_CALL_ERROR
 
 };