aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-01-16 11:47:42 +0000
committerChristian Grothoff <christian@grothoff.org>2015-01-16 11:47:42 +0000
commit4601b844cb667e8e6ac6dbaee77feddf64e0d8b7 (patch)
tree36fc761ca0e2b0d31ea93e811f184abfa062e8bd
parent8e234654d3dbcc594f29dcc6ccfbecb743e32246 (diff)
fix #3611
-rw-r--r--src/conversation/conversation_api_call.c93
-rw-r--r--src/conversation/gnunet-conversation.c5
-rw-r--r--src/include/gnunet_conversation_service.h1
-rwxr-xr-xsrc/scalarproduct/perf_scalarproduct.sh2
-rw-r--r--src/util/client.c2
5 files changed, 52 insertions, 51 deletions
diff --git a/src/conversation/conversation_api_call.c b/src/conversation/conversation_api_call.c
index 1b51ad397b..7d56689daf 100644
--- a/src/conversation/conversation_api_call.c
+++ b/src/conversation/conversation_api_call.c
@@ -485,27 +485,6 @@ call_error_handler (void *cls,
static void
reconnect_call (struct GNUNET_CONVERSATION_Call *call)
{
- static struct GNUNET_MQ_MessageHandler handlers[] =
- {
- { &handle_call_suspend,
- GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_SUSPEND,
- sizeof (struct ClientPhoneSuspendMessage) },
- { &handle_call_resume,
- GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RESUME,
- sizeof (struct ClientPhoneResumeMessage) },
- { &handle_call_picked_up,
- GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICKED_UP,
- sizeof (struct ClientPhonePickedupMessage) },
- { &handle_call_hangup,
- GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP,
- sizeof (struct ClientPhoneHangupMessage) },
- { &handle_call_audio_message,
- GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO,
- 0 },
- { NULL, 0, 0 }
- };
- struct GNUNET_CRYPTO_EcdsaPublicKey my_zone;
-
if (CS_ACTIVE == call->state)
{
call->speaker->disable_speaker (call->speaker->cls);
@@ -522,29 +501,9 @@ reconnect_call (struct GNUNET_CONVERSATION_Call *call)
call->client = NULL;
}
call->state = CS_SHUTDOWN;
- call->client = GNUNET_CLIENT_connect ("conversation", call->cfg);
- if (NULL == call->client)
- {
- call->event_handler (call->event_handler_cls,
+ 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,
- call);
- call->state = CS_LOOKUP;
- GNUNET_IDENTITY_ego_get_public_key (call->zone_id,
- &my_zone);
- call->gns_lookup = GNUNET_GNS_lookup (call->gns,
- call->callee,
- &my_zone,
- GNUNET_GNSRECORD_TYPE_PHONE,
- GNUNET_NO,
- NULL /* FIXME: add shortening support */,
- &handle_gns_response, call);
- GNUNET_assert (NULL != call->gns_lookup);
+ GNUNET_CONVERSATION_call_stop (call);
}
@@ -562,6 +521,7 @@ reconnect_call (struct GNUNET_CONVERSATION_Call *call)
* #GNUNET_CONVERSATION_EC_CALL_PICKED_UP event is generated)
* @param event_handler how to notify the owner of the phone about events
* @param event_handler_cls closure for @a event_handler
+ * @return handle for the call, NULL on hard errors
*/
struct GNUNET_CONVERSATION_Call *
GNUNET_CONVERSATION_call_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
@@ -573,9 +533,36 @@ GNUNET_CONVERSATION_call_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
GNUNET_CONVERSATION_CallEventHandler event_handler,
void *event_handler_cls)
{
+ static struct GNUNET_MQ_MessageHandler handlers[] =
+ {
+ { &handle_call_suspend,
+ GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_SUSPEND,
+ sizeof (struct ClientPhoneSuspendMessage) },
+ { &handle_call_resume,
+ GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RESUME,
+ sizeof (struct ClientPhoneResumeMessage) },
+ { &handle_call_picked_up,
+ GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICKED_UP,
+ sizeof (struct ClientPhonePickedupMessage) },
+ { &handle_call_hangup,
+ GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP,
+ sizeof (struct ClientPhoneHangupMessage) },
+ { &handle_call_audio_message,
+ GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO,
+ 0 },
+ { NULL, 0, 0 }
+ };
+ struct GNUNET_CRYPTO_EcdsaPublicKey my_zone;
struct GNUNET_CONVERSATION_Call *call;
call = GNUNET_new (struct GNUNET_CONVERSATION_Call);
+ call->client = GNUNET_CLIENT_connect ("conversation", cfg);
+ if (NULL == call->client)
+ {
+ GNUNET_break (0);
+ GNUNET_free (call);
+ return NULL;
+ }
call->cfg = cfg;
call->caller_id = caller_id;
call->zone_id = zone_id;
@@ -585,14 +572,26 @@ GNUNET_CONVERSATION_call_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
call->event_handler = event_handler;
call->event_handler_cls = event_handler_cls;
call->gns = GNUNET_GNS_connect (cfg);
- reconnect_call (call);
-
- if ( (NULL == call->client) ||
- (NULL == call->gns) )
+ if (NULL == call->gns)
{
GNUNET_CONVERSATION_call_stop (call);
return NULL;
}
+ call->mq = GNUNET_MQ_queue_for_connection_client (call->client,
+ handlers,
+ &call_error_handler,
+ call);
+ call->state = CS_LOOKUP;
+ GNUNET_IDENTITY_ego_get_public_key (call->zone_id,
+ &my_zone);
+ call->gns_lookup = GNUNET_GNS_lookup (call->gns,
+ call->callee,
+ &my_zone,
+ GNUNET_GNSRECORD_TYPE_PHONE,
+ GNUNET_NO,
+ NULL /* FIXME: add shortening support */,
+ &handle_gns_response, call);
+ GNUNET_assert (NULL != call->gns_lookup);
return call;
}
diff --git a/src/conversation/gnunet-conversation.c b/src/conversation/gnunet-conversation.c
index 6c133966d7..62bfe000ab 100644
--- a/src/conversation/gnunet-conversation.c
+++ b/src/conversation/gnunet-conversation.c
@@ -440,8 +440,9 @@ call_event_handler (void *cls,
case GNUNET_CONVERSATION_EC_CALL_ERROR:
FPRINTF (stdout,
_("Error with the call, restarting it\n"));
- call_state = CS_RESOLVING;
- // FIXME: is this correct?
+ GNUNET_free (peer_name);
+ peer_name = NULL;
+ call = NULL;
break;
}
}
diff --git a/src/include/gnunet_conversation_service.h b/src/include/gnunet_conversation_service.h
index c6ab950050..31e71b1903 100644
--- a/src/include/gnunet_conversation_service.h
+++ b/src/include/gnunet_conversation_service.h
@@ -295,6 +295,7 @@ struct GNUNET_CONVERSATION_Call;
*/
enum GNUNET_CONVERSATION_CallEventCode
{
+
/**
* We are the caller and are now ringing the other party (GNS lookup
* succeeded).
diff --git a/src/scalarproduct/perf_scalarproduct.sh b/src/scalarproduct/perf_scalarproduct.sh
index aac184d915..6c7b4ad72b 100755
--- a/src/scalarproduct/perf_scalarproduct.sh
+++ b/src/scalarproduct/perf_scalarproduct.sh
@@ -10,7 +10,7 @@
# 400 149 23
# 800 304 32
# Configure benchmark size:
-SIZE=25
+SIZE=1600
#
# Construct input vectors:
INPUTALICE="-k CCC -e '"
diff --git a/src/util/client.c b/src/util/client.c
index 7128a2de43..babb6a5168 100644
--- a/src/util/client.c
+++ b/src/util/client.c
@@ -1208,7 +1208,7 @@ GNUNET_CLIENT_notify_transmit_ready (struct GNUNET_CLIENT_Connection *client,
{
/* If this breaks, you most likley called this function twice without waiting
* for completion or canceling the request */
- GNUNET_break (0);
+ GNUNET_assert (0);
return NULL;
}
th = GNUNET_new (struct GNUNET_CLIENT_TransmitHandle);