aboutsummaryrefslogtreecommitdiff
path: root/src/conversation/test_conversation_api_twocalls.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-03-30 16:23:29 +0200
committerChristian Grothoff <christian@grothoff.org>2018-03-30 16:23:29 +0200
commitb7513a90c350bc3f768c3b1e7a42228f272314dd (patch)
tree470c89c4204905fdcba9e859a468790295d3fd26 /src/conversation/test_conversation_api_twocalls.c
parent7075d32a5bd56a95797b1113e4cf5638c14ca8fc (diff)
downloadgnunet-b7513a90c350bc3f768c3b1e7a42228f272314dd.tar.gz
gnunet-b7513a90c350bc3f768c3b1e7a42228f272314dd.zip
fix conversation ftbfs issues:
Diffstat (limited to 'src/conversation/test_conversation_api_twocalls.c')
-rw-r--r--src/conversation/test_conversation_api_twocalls.c66
1 files changed, 51 insertions, 15 deletions
diff --git a/src/conversation/test_conversation_api_twocalls.c b/src/conversation/test_conversation_api_twocalls.c
index 7d2705e70..ac3a87fad 100644
--- a/src/conversation/test_conversation_api_twocalls.c
+++ b/src/conversation/test_conversation_api_twocalls.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2013 GNUnet e.V. 3 Copyright (C) 2013, 2018x GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -130,11 +130,15 @@ phone_send (void *cls)
130{ 130{
131 char buf[32]; 131 char buf[32];
132 132
133 (void) cls;
133 GNUNET_assert (NULL != phone_rdc); 134 GNUNET_assert (NULL != phone_rdc);
134 GNUNET_snprintf (buf, sizeof (buf), "phone"); 135 GNUNET_snprintf (buf, sizeof (buf), "phone");
135 phone_rdc (phone_rdc_cls, strlen (buf) + 1, buf); 136 phone_rdc (phone_rdc_cls,
137 strlen (buf) + 1,
138 buf);
136 phone_task = GNUNET_SCHEDULER_add_delayed (FREQ, 139 phone_task = GNUNET_SCHEDULER_add_delayed (FREQ,
137 &phone_send, NULL); 140 &phone_send,
141 NULL);
138} 142}
139 143
140 144
@@ -144,11 +148,17 @@ call_send (void *cls)
144 struct MicContext *mc = cls; 148 struct MicContext *mc = cls;
145 char buf[32]; 149 char buf[32];
146 150
151 (void) cls;
147 GNUNET_assert (NULL != mc->rdc); 152 GNUNET_assert (NULL != mc->rdc);
148 GNUNET_snprintf (buf, sizeof (buf), "call"); 153 GNUNET_snprintf (buf,
149 mc->rdc (mc->rdc_cls, strlen (buf) + 1, buf); 154 sizeof (buf),
155 "call");
156 mc->rdc (mc->rdc_cls,
157 strlen (buf) + 1,
158 buf);
150 mc->call_task = GNUNET_SCHEDULER_add_delayed (FREQ, 159 mc->call_task = GNUNET_SCHEDULER_add_delayed (FREQ,
151 &call_send, mc); 160 &call_send,
161 mc);
152} 162}
153 163
154 164
@@ -157,6 +167,7 @@ enable_speaker (void *cls)
157{ 167{
158 const char *origin = CLS_STR (cls); 168 const char *origin = CLS_STR (cls);
159 169
170 (void) cls;
160 LOG_DEBUG ("Speaker %s enabled\n", 171 LOG_DEBUG ("Speaker %s enabled\n",
161 origin); 172 origin);
162 return GNUNET_OK; 173 return GNUNET_OK;
@@ -168,6 +179,7 @@ disable_speaker (void *cls)
168{ 179{
169 const char *origin = CLS_STR (cls); 180 const char *origin = CLS_STR (cls);
170 181
182 (void) cls;
171 LOG_DEBUG ("Speaker %s disabled\n", 183 LOG_DEBUG ("Speaker %s disabled\n",
172 origin); 184 origin);
173} 185}
@@ -181,6 +193,7 @@ play (void *cls,
181 static unsigned int phone_i; 193 static unsigned int phone_i;
182 static unsigned int call_i; 194 static unsigned int call_i;
183 195
196 (void) cls;
184 if (0 == strncmp ("call", data, data_size)) 197 if (0 == strncmp ("call", data, data_size))
185 call_i++; 198 call_i++;
186 else if (0 == strncmp ("phone", data, data_size)) 199 else if (0 == strncmp ("phone", data, data_size))
@@ -348,6 +361,7 @@ static struct GNUNET_MICROPHONE_Handle phone_mic = {
348static void 361static void
349end_test (void *cls) 362end_test (void *cls)
350{ 363{
364 (void) cls;
351 timeout_task = NULL; 365 timeout_task = NULL;
352 fprintf (stderr, 366 fprintf (stderr,
353 "Timeout!\n"); 367 "Timeout!\n");
@@ -363,6 +377,7 @@ end_test (void *cls)
363static void 377static void
364do_shutdown (void *cls) 378do_shutdown (void *cls)
365{ 379{
380 (void) cls;
366 if (NULL != timeout_task) 381 if (NULL != timeout_task)
367 { 382 {
368 GNUNET_SCHEDULER_cancel (timeout_task); 383 GNUNET_SCHEDULER_cancel (timeout_task);
@@ -411,11 +426,14 @@ static void
411caller_event_handler (void *cls, 426caller_event_handler (void *cls,
412 enum GNUNET_CONVERSATION_CallerEventCode code) 427 enum GNUNET_CONVERSATION_CallerEventCode code)
413{ 428{
429 (void) cls;
414 switch (code) 430 switch (code)
415 { 431 {
416 case GNUNET_CONVERSATION_EC_CALLER_SUSPEND: 432 case GNUNET_CONVERSATION_EC_CALLER_SUSPEND:
417 case GNUNET_CONVERSATION_EC_CALLER_RESUME: 433 case GNUNET_CONVERSATION_EC_CALLER_RESUME:
418 LOG (GNUNET_ERROR_TYPE_WARNING, "Unexpected caller code: %d\n", code); 434 LOG (GNUNET_ERROR_TYPE_WARNING,
435 "Unexpected caller code: %d\n",
436 code);
419 break; 437 break;
420 } 438 }
421} 439}
@@ -428,6 +446,8 @@ phone_event_handler (void *cls,
428 const struct GNUNET_CRYPTO_EcdsaPublicKey *caller_id) 446 const struct GNUNET_CRYPTO_EcdsaPublicKey *caller_id)
429{ 447{
430 const char *cid; 448 const char *cid;
449 (void) cls;
450 (void) caller_id;
431 451
432 switch (code) 452 switch (code)
433 { 453 {
@@ -470,7 +490,9 @@ phone_event_handler (void *cls,
470 } 490 }
471 break; 491 break;
472 default: 492 default:
473 LOG (GNUNET_ERROR_TYPE_WARNING, "Unexpected phone code: %d\n", code); 493 LOG (GNUNET_ERROR_TYPE_WARNING,
494 "Unexpected phone code: %d\n",
495 code);
474 break; 496 break;
475 } 497 }
476} 498}
@@ -521,6 +543,7 @@ static void
521caller_ego_create_cont (void *cls, 543caller_ego_create_cont (void *cls,
522 const char *emsg) 544 const char *emsg)
523{ 545{
546 (void) cls;
524 op = NULL; 547 op = NULL;
525 GNUNET_assert (NULL == emsg); 548 GNUNET_assert (NULL == emsg);
526} 549}
@@ -531,11 +554,15 @@ namestore_put_cont (void *cls,
531 int32_t success, 554 int32_t success,
532 const char *emsg) 555 const char *emsg)
533{ 556{
557 (void) cls;
534 qe = NULL; 558 qe = NULL;
535 GNUNET_assert (GNUNET_YES == success); 559 GNUNET_assert (GNUNET_YES == success);
536 GNUNET_assert (NULL == emsg); 560 GNUNET_assert (NULL == emsg);
537 GNUNET_assert (NULL == op); 561 GNUNET_assert (NULL == op);
538 op = GNUNET_IDENTITY_create (id, "caller-ego", &caller_ego_create_cont, NULL); 562 op = GNUNET_IDENTITY_create (id,
563 "caller-ego",
564 &caller_ego_create_cont,
565 NULL);
539} 566}
540 567
541 568
@@ -548,6 +575,8 @@ identity_cb (void *cls,
548 struct GNUNET_GNSRECORD_Data rd; 575 struct GNUNET_GNSRECORD_Data rd;
549 struct GNUNET_CRYPTO_EcdsaPublicKey pub; 576 struct GNUNET_CRYPTO_EcdsaPublicKey pub;
550 577
578 (void) cls;
579 (void) ctx;
551 if (NULL == name) 580 if (NULL == name)
552 return; 581 return;
553 if (NULL == ego) 582 if (NULL == ego)
@@ -585,7 +614,6 @@ identity_cb (void *cls,
585 GNUNET_GNSRECORD_pkey_to_zkey (&pub)); 614 GNUNET_GNSRECORD_pkey_to_zkey (&pub));
586 call1 = GNUNET_CONVERSATION_call_start (cfg, 615 call1 = GNUNET_CONVERSATION_call_start (cfg,
587 ego, 616 ego,
588 ego,
589 gns_name, 617 gns_name,
590 &call1_speaker, 618 &call1_speaker,
591 &call1_mic, 619 &call1_mic,
@@ -593,7 +621,6 @@ identity_cb (void *cls,
593 (void *) "call1"); 621 (void *) "call1");
594 call2 = GNUNET_CONVERSATION_call_start (cfg, 622 call2 = GNUNET_CONVERSATION_call_start (cfg,
595 ego, 623 ego,
596 ego,
597 gns_name, 624 gns_name,
598 &call2_speaker, 625 &call2_speaker,
599 &call2_mic, 626 &call2_mic,
@@ -608,6 +635,7 @@ static void
608phone_ego_create_cont (void *cls, 635phone_ego_create_cont (void *cls,
609 const char *emsg) 636 const char *emsg)
610{ 637{
638 (void) cls;
611 op = NULL; 639 op = NULL;
612 GNUNET_assert (NULL == emsg); 640 GNUNET_assert (NULL == emsg);
613} 641}
@@ -618,6 +646,8 @@ run (void *cls,
618 const struct GNUNET_CONFIGURATION_Handle *c, 646 const struct GNUNET_CONFIGURATION_Handle *c,
619 struct GNUNET_TESTING_Peer *peer) 647 struct GNUNET_TESTING_Peer *peer)
620{ 648{
649 (void) cls;
650 (void) peer;
621 cfg = c; 651 cfg = c;
622 timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 652 timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
623 &end_test, 653 &end_test,
@@ -627,18 +657,24 @@ run (void *cls,
627 id = GNUNET_IDENTITY_connect (cfg, 657 id = GNUNET_IDENTITY_connect (cfg,
628 &identity_cb, 658 &identity_cb,
629 NULL); 659 NULL);
630 op = GNUNET_IDENTITY_create (id, "phone-ego", &phone_ego_create_cont, NULL); 660 op = GNUNET_IDENTITY_create (id,
661 "phone-ego",
662 &phone_ego_create_cont,
663 NULL);
631 ns = GNUNET_NAMESTORE_connect (cfg); 664 ns = GNUNET_NAMESTORE_connect (cfg);
632} 665}
633 666
634 667
635int 668int
636main (int argc, char *argv[]) 669main (int argc,
670 char *argv[])
637{ 671{
638 672 (void) argc;
673 (void) argv;
639 if (0 != GNUNET_TESTING_peer_run ("test_conversation_api_twocalls", 674 if (0 != GNUNET_TESTING_peer_run ("test_conversation_api_twocalls",
640 "test_conversation.conf", 675 "test_conversation.conf",
641 &run, NULL)) 676 &run,
677 NULL))
642 return 1; 678 return 1;
643 if (call1_finished && call2_finished) 679 if (call1_finished && call2_finished)
644 return 0; 680 return 0;