diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-01-16 11:47:42 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-01-16 11:47:42 +0000 |
commit | 4601b844cb667e8e6ac6dbaee77feddf64e0d8b7 (patch) | |
tree | 36fc761ca0e2b0d31ea93e811f184abfa062e8bd | |
parent | 8e234654d3dbcc594f29dcc6ccfbecb743e32246 (diff) | |
download | gnunet-4601b844cb667e8e6ac6dbaee77feddf64e0d8b7.tar.gz gnunet-4601b844cb667e8e6ac6dbaee77feddf64e0d8b7.zip |
fix #3611
-rw-r--r-- | src/conversation/conversation_api_call.c | 93 | ||||
-rw-r--r-- | src/conversation/gnunet-conversation.c | 5 | ||||
-rw-r--r-- | src/include/gnunet_conversation_service.h | 1 | ||||
-rwxr-xr-x | src/scalarproduct/perf_scalarproduct.sh | 2 | ||||
-rw-r--r-- | src/util/client.c | 2 |
5 files changed, 52 insertions, 51 deletions
diff --git a/src/conversation/conversation_api_call.c b/src/conversation/conversation_api_call.c index 1b51ad397..7d56689da 100644 --- a/src/conversation/conversation_api_call.c +++ b/src/conversation/conversation_api_call.c | |||
@@ -485,27 +485,6 @@ call_error_handler (void *cls, | |||
485 | static void | 485 | static void |
486 | reconnect_call (struct GNUNET_CONVERSATION_Call *call) | 486 | reconnect_call (struct GNUNET_CONVERSATION_Call *call) |
487 | { | 487 | { |
488 | static struct GNUNET_MQ_MessageHandler handlers[] = | ||
489 | { | ||
490 | { &handle_call_suspend, | ||
491 | GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_SUSPEND, | ||
492 | sizeof (struct ClientPhoneSuspendMessage) }, | ||
493 | { &handle_call_resume, | ||
494 | GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RESUME, | ||
495 | sizeof (struct ClientPhoneResumeMessage) }, | ||
496 | { &handle_call_picked_up, | ||
497 | GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICKED_UP, | ||
498 | sizeof (struct ClientPhonePickedupMessage) }, | ||
499 | { &handle_call_hangup, | ||
500 | GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP, | ||
501 | sizeof (struct ClientPhoneHangupMessage) }, | ||
502 | { &handle_call_audio_message, | ||
503 | GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO, | ||
504 | 0 }, | ||
505 | { NULL, 0, 0 } | ||
506 | }; | ||
507 | struct GNUNET_CRYPTO_EcdsaPublicKey my_zone; | ||
508 | |||
509 | if (CS_ACTIVE == call->state) | 488 | if (CS_ACTIVE == call->state) |
510 | { | 489 | { |
511 | call->speaker->disable_speaker (call->speaker->cls); | 490 | call->speaker->disable_speaker (call->speaker->cls); |
@@ -522,29 +501,9 @@ reconnect_call (struct GNUNET_CONVERSATION_Call *call) | |||
522 | call->client = NULL; | 501 | call->client = NULL; |
523 | } | 502 | } |
524 | call->state = CS_SHUTDOWN; | 503 | call->state = CS_SHUTDOWN; |
525 | call->client = GNUNET_CLIENT_connect ("conversation", call->cfg); | 504 | call->event_handler (call->event_handler_cls, |
526 | if (NULL == call->client) | ||
527 | { | ||
528 | call->event_handler (call->event_handler_cls, | ||
529 | GNUNET_CONVERSATION_EC_CALL_ERROR); | 505 | GNUNET_CONVERSATION_EC_CALL_ERROR); |
530 | return; | 506 | GNUNET_CONVERSATION_call_stop (call); |
531 | } | ||
532 | |||
533 | call->mq = GNUNET_MQ_queue_for_connection_client (call->client, | ||
534 | handlers, | ||
535 | &call_error_handler, | ||
536 | call); | ||
537 | call->state = CS_LOOKUP; | ||
538 | GNUNET_IDENTITY_ego_get_public_key (call->zone_id, | ||
539 | &my_zone); | ||
540 | call->gns_lookup = GNUNET_GNS_lookup (call->gns, | ||
541 | call->callee, | ||
542 | &my_zone, | ||
543 | GNUNET_GNSRECORD_TYPE_PHONE, | ||
544 | GNUNET_NO, | ||
545 | NULL /* FIXME: add shortening support */, | ||
546 | &handle_gns_response, call); | ||
547 | GNUNET_assert (NULL != call->gns_lookup); | ||
548 | } | 507 | } |
549 | 508 | ||
550 | 509 | ||
@@ -562,6 +521,7 @@ reconnect_call (struct GNUNET_CONVERSATION_Call *call) | |||
562 | * #GNUNET_CONVERSATION_EC_CALL_PICKED_UP event is generated) | 521 | * #GNUNET_CONVERSATION_EC_CALL_PICKED_UP event is generated) |
563 | * @param event_handler how to notify the owner of the phone about events | 522 | * @param event_handler how to notify the owner of the phone about events |
564 | * @param event_handler_cls closure for @a event_handler | 523 | * @param event_handler_cls closure for @a event_handler |
524 | * @return handle for the call, NULL on hard errors | ||
565 | */ | 525 | */ |
566 | struct GNUNET_CONVERSATION_Call * | 526 | struct GNUNET_CONVERSATION_Call * |
567 | GNUNET_CONVERSATION_call_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | 527 | GNUNET_CONVERSATION_call_start (const struct GNUNET_CONFIGURATION_Handle *cfg, |
@@ -573,9 +533,36 @@ GNUNET_CONVERSATION_call_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
573 | GNUNET_CONVERSATION_CallEventHandler event_handler, | 533 | GNUNET_CONVERSATION_CallEventHandler event_handler, |
574 | void *event_handler_cls) | 534 | void *event_handler_cls) |
575 | { | 535 | { |
536 | static struct GNUNET_MQ_MessageHandler handlers[] = | ||
537 | { | ||
538 | { &handle_call_suspend, | ||
539 | GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_SUSPEND, | ||
540 | sizeof (struct ClientPhoneSuspendMessage) }, | ||
541 | { &handle_call_resume, | ||
542 | GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_RESUME, | ||
543 | sizeof (struct ClientPhoneResumeMessage) }, | ||
544 | { &handle_call_picked_up, | ||
545 | GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_PICKED_UP, | ||
546 | sizeof (struct ClientPhonePickedupMessage) }, | ||
547 | { &handle_call_hangup, | ||
548 | GNUNET_MESSAGE_TYPE_CONVERSATION_CS_PHONE_HANG_UP, | ||
549 | sizeof (struct ClientPhoneHangupMessage) }, | ||
550 | { &handle_call_audio_message, | ||
551 | GNUNET_MESSAGE_TYPE_CONVERSATION_CS_AUDIO, | ||
552 | 0 }, | ||
553 | { NULL, 0, 0 } | ||
554 | }; | ||
555 | struct GNUNET_CRYPTO_EcdsaPublicKey my_zone; | ||
576 | struct GNUNET_CONVERSATION_Call *call; | 556 | struct GNUNET_CONVERSATION_Call *call; |
577 | 557 | ||
578 | call = GNUNET_new (struct GNUNET_CONVERSATION_Call); | 558 | call = GNUNET_new (struct GNUNET_CONVERSATION_Call); |
559 | call->client = GNUNET_CLIENT_connect ("conversation", cfg); | ||
560 | if (NULL == call->client) | ||
561 | { | ||
562 | GNUNET_break (0); | ||
563 | GNUNET_free (call); | ||
564 | return NULL; | ||
565 | } | ||
579 | call->cfg = cfg; | 566 | call->cfg = cfg; |
580 | call->caller_id = caller_id; | 567 | call->caller_id = caller_id; |
581 | call->zone_id = zone_id; | 568 | call->zone_id = zone_id; |
@@ -585,14 +572,26 @@ GNUNET_CONVERSATION_call_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
585 | call->event_handler = event_handler; | 572 | call->event_handler = event_handler; |
586 | call->event_handler_cls = event_handler_cls; | 573 | call->event_handler_cls = event_handler_cls; |
587 | call->gns = GNUNET_GNS_connect (cfg); | 574 | call->gns = GNUNET_GNS_connect (cfg); |
588 | reconnect_call (call); | 575 | if (NULL == call->gns) |
589 | |||
590 | if ( (NULL == call->client) || | ||
591 | (NULL == call->gns) ) | ||
592 | { | 576 | { |
593 | GNUNET_CONVERSATION_call_stop (call); | 577 | GNUNET_CONVERSATION_call_stop (call); |
594 | return NULL; | 578 | return NULL; |
595 | } | 579 | } |
580 | call->mq = GNUNET_MQ_queue_for_connection_client (call->client, | ||
581 | handlers, | ||
582 | &call_error_handler, | ||
583 | call); | ||
584 | call->state = CS_LOOKUP; | ||
585 | GNUNET_IDENTITY_ego_get_public_key (call->zone_id, | ||
586 | &my_zone); | ||
587 | call->gns_lookup = GNUNET_GNS_lookup (call->gns, | ||
588 | call->callee, | ||
589 | &my_zone, | ||
590 | GNUNET_GNSRECORD_TYPE_PHONE, | ||
591 | GNUNET_NO, | ||
592 | NULL /* FIXME: add shortening support */, | ||
593 | &handle_gns_response, call); | ||
594 | GNUNET_assert (NULL != call->gns_lookup); | ||
596 | return call; | 595 | return call; |
597 | } | 596 | } |
598 | 597 | ||
diff --git a/src/conversation/gnunet-conversation.c b/src/conversation/gnunet-conversation.c index 6c133966d..62bfe000a 100644 --- a/src/conversation/gnunet-conversation.c +++ b/src/conversation/gnunet-conversation.c | |||
@@ -440,8 +440,9 @@ call_event_handler (void *cls, | |||
440 | case GNUNET_CONVERSATION_EC_CALL_ERROR: | 440 | case GNUNET_CONVERSATION_EC_CALL_ERROR: |
441 | FPRINTF (stdout, | 441 | FPRINTF (stdout, |
442 | _("Error with the call, restarting it\n")); | 442 | _("Error with the call, restarting it\n")); |
443 | call_state = CS_RESOLVING; | 443 | GNUNET_free (peer_name); |
444 | // FIXME: is this correct? | 444 | peer_name = NULL; |
445 | call = NULL; | ||
445 | break; | 446 | break; |
446 | } | 447 | } |
447 | } | 448 | } |
diff --git a/src/include/gnunet_conversation_service.h b/src/include/gnunet_conversation_service.h index c6ab95005..31e71b190 100644 --- a/src/include/gnunet_conversation_service.h +++ b/src/include/gnunet_conversation_service.h | |||
@@ -295,6 +295,7 @@ struct GNUNET_CONVERSATION_Call; | |||
295 | */ | 295 | */ |
296 | enum GNUNET_CONVERSATION_CallEventCode | 296 | enum GNUNET_CONVERSATION_CallEventCode |
297 | { | 297 | { |
298 | |||
298 | /** | 299 | /** |
299 | * We are the caller and are now ringing the other party (GNS lookup | 300 | * We are the caller and are now ringing the other party (GNS lookup |
300 | * succeeded). | 301 | * succeeded). |
diff --git a/src/scalarproduct/perf_scalarproduct.sh b/src/scalarproduct/perf_scalarproduct.sh index aac184d91..6c7b4ad72 100755 --- a/src/scalarproduct/perf_scalarproduct.sh +++ b/src/scalarproduct/perf_scalarproduct.sh | |||
@@ -10,7 +10,7 @@ | |||
10 | # 400 149 23 | 10 | # 400 149 23 |
11 | # 800 304 32 | 11 | # 800 304 32 |
12 | # Configure benchmark size: | 12 | # Configure benchmark size: |
13 | SIZE=25 | 13 | SIZE=1600 |
14 | # | 14 | # |
15 | # Construct input vectors: | 15 | # Construct input vectors: |
16 | INPUTALICE="-k CCC -e '" | 16 | INPUTALICE="-k CCC -e '" |
diff --git a/src/util/client.c b/src/util/client.c index 7128a2de4..babb6a516 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, | |||
1208 | { | 1208 | { |
1209 | /* If this breaks, you most likley called this function twice without waiting | 1209 | /* If this breaks, you most likley called this function twice without waiting |
1210 | * for completion or canceling the request */ | 1210 | * for completion or canceling the request */ |
1211 | GNUNET_break (0); | 1211 | GNUNET_assert (0); |
1212 | return NULL; | 1212 | return NULL; |
1213 | } | 1213 | } |
1214 | th = GNUNET_new (struct GNUNET_CLIENT_TransmitHandle); | 1214 | th = GNUNET_new (struct GNUNET_CLIENT_TransmitHandle); |