break;
case CS_ACTIVE:
call->state = CS_SUSPENDED_CALLEE;
- call->event_handler (call->event_handler_cls,
- GNUNET_CONVERSATION_EC_CALL_SUSPENDED);
call->speaker->disable_speaker (call->speaker->cls);
call->mic->disable_microphone (call->mic->cls);
+ call->event_handler (call->event_handler_cls,
+ GNUNET_CONVERSATION_EC_CALL_SUSPENDED);
break;
case CS_SHUTDOWN:
GNUNET_CONVERSATION_call_stop (call);
break;
case CS_SUSPENDED_CALLEE:
call->state = CS_ACTIVE;
- call->event_handler (call->event_handler_cls,
- GNUNET_CONVERSATION_EC_CALL_RESUMED);
call->speaker->enable_speaker (call->speaker->cls);
call->mic->enable_microphone (call->mic->cls,
&transmit_call_audio,
call);
+ call->event_handler (call->event_handler_cls,
+ GNUNET_CONVERSATION_EC_CALL_RESUMED);
break;
case CS_SUSPENDED_BOTH:
call->state = CS_SUSPENDED_CALLER;
break;
case CS_RINGING:
call->state = CS_ACTIVE;
- call->event_handler (call->event_handler_cls,
- GNUNET_CONVERSATION_EC_CALL_PICKED_UP);
call->speaker->enable_speaker (call->speaker->cls);
call->mic->enable_microphone (call->mic->cls,
&transmit_call_audio,
call);
+ call->event_handler (call->event_handler_cls,
+ GNUNET_CONVERSATION_EC_CALL_PICKED_UP);
break;
case CS_SUSPENDED_CALLER:
case CS_SUSPENDED_CALLEE:
const struct GNUNET_MessageHeader *msg)
{
struct GNUNET_CONVERSATION_Call *call = cls;
+ GNUNET_CONVERSATION_CallEventHandler eh;
+ void *eh_cls;
switch (call->state)
{
case CS_SUSPENDED_CALLEE:
case CS_SUSPENDED_BOTH:
case CS_ACTIVE:
- call->event_handler (call->event_handler_cls,
- GNUNET_CONVERSATION_EC_CALL_HUNG_UP);
+ eh = call->event_handler;
+ eh_cls = call->event_handler_cls;
GNUNET_CONVERSATION_call_stop (call);
+ eh (eh_cls, GNUNET_CONVERSATION_EC_CALL_HUNG_UP);
return;
case CS_SHUTDOWN:
GNUNET_CONVERSATION_call_stop (call);
struct GNUNET_MQ_Envelope *e;
struct ClientCallMessage *ccm;
+ GNUNET_break (NULL != call->gns_lookup);
+ GNUNET_break (CS_LOOKUP == call->state);
call->gns_lookup = NULL;
for (i=0;i<rd_count;i++)
{
{
struct GNUNET_CONVERSATION_Call *call = cls;
- GNUNET_break (0);
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Internal MQ error %d\n"),
- error);
+ if (CS_SHUTDOWN == call->state)
+ {
+ GNUNET_CONVERSATION_call_stop (call);
+ return;
+ }
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ _("Connection to conversation service lost, trying to reconnect\n"));
reconnect_call (call);
}
call->state = CS_SHUTDOWN;
call->client = GNUNET_CLIENT_connect ("conversation", call->cfg);
if (NULL == call->client)
+ {
+ call->event_handler (call->event_handler_cls,
+ GNUNET_CONVERSATION_EC_CALL_ERROR);
return;
+ }
+
call->mq = GNUNET_MQ_queue_for_connection_client (call->client,
handlers,
&call_error_handler,
}
-/**
- * We've sent the hang up message, now finish terminating the call.
- *
- * @param cls the `struct GNUNET_CONVERSATION_Call` to terminate
- */
-static void
-finish_stop (void *cls)
-{
- struct GNUNET_CONVERSATION_Call *call = cls;
-
- GNUNET_assert (CS_SHUTDOWN == call->state);
- GNUNET_CONVERSATION_call_stop (call);
-}
-
-
/**
* Terminate a call. The call may be ringing or ready at this time.
*
void
GNUNET_CONVERSATION_call_stop (struct GNUNET_CONVERSATION_Call *call)
{
- struct GNUNET_MQ_Envelope *e;
- struct ClientPhoneHangupMessage *hang;
-
if ( (NULL != call->speaker) &&
(CS_ACTIVE == call->state) )
call->speaker->disable_speaker (call->speaker->cls);
if (CS_SHUTDOWN != call->state)
{
call->state = CS_SHUTDOWN;
- e = GNUNET_MQ_msg (hang, GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP);
- GNUNET_MQ_notify_sent (e, &finish_stop, call);
- GNUNET_MQ_send (call->mq, e);
- return;
}
if (NULL != call->mq)
{