[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r25710 - gnunet/src/testbed
From: |
gnunet |
Subject: |
[GNUnet-SVN] r25710 - gnunet/src/testbed |
Date: |
Mon, 7 Jan 2013 17:37:24 +0100 |
Author: harsha
Date: 2013-01-07 17:37:24 +0100 (Mon, 07 Jan 2013)
New Revision: 25710
Modified:
gnunet/src/testbed/test_testbed_api_2peers_1controller.c
gnunet/src/testbed/test_testbed_api_3peers_3controllers.c
gnunet/src/testbed/testbed_api.c
Log:
- call controller callback before operation completion callback; only way to
ensure that GNUNET_TESTBED_operation_done() on
GNUNET_TESTBED_underlay_configure_topology() operations doesn't result in
segfault.
Modified: gnunet/src/testbed/test_testbed_api_2peers_1controller.c
===================================================================
--- gnunet/src/testbed/test_testbed_api_2peers_1controller.c 2013-01-07
16:34:38 UTC (rev 25709)
+++ gnunet/src/testbed/test_testbed_api_2peers_1controller.c 2013-01-07
16:37:24 UTC (rev 25710)
@@ -265,24 +265,11 @@
FAIL_TEST (NULL == peer1.operation);
FAIL_TEST (NULL == peer2.operation);
FAIL_TEST (NULL != common_operation);
- GNUNET_TESTBED_operation_done (common_operation);
- common_operation = NULL;
- result = PEERS_CONNECTED;
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Peers connected\n");
- delayed_connect_task =
- GNUNET_SCHEDULER_add_delayed (TIME_REL_SECS (3),
- &do_delayed_connect, NULL);
break;
case PEERS_CONNECTED:
FAIL_TEST (NULL == peer1.operation);
FAIL_TEST (NULL == peer2.operation);
FAIL_TEST (NULL != common_operation);
- GNUNET_TESTBED_operation_done (common_operation);
- common_operation = NULL;
- result = PEERS_CONNECTED_2;
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Peers connected again\n");
- peer1.operation = GNUNET_TESTBED_peer_stop (peer1.peer, NULL, NULL);
- peer2.operation = GNUNET_TESTBED_peer_stop (peer2.peer, NULL, NULL);
break;
default:
FAIL_TEST (0);
@@ -375,13 +362,30 @@
switch (result)
{
case PEERS_STARTED:
- case PEERS_CONNECTED:
FAIL_TEST (NULL == peer1.operation);
FAIL_TEST (NULL == peer2.operation);
FAIL_TEST (NULL != common_operation);
FAIL_TEST ((event->details.peer_connect.peer1 == peer1.peer) &&
(event->details.peer_connect.peer2 == peer2.peer));
+ GNUNET_TESTBED_operation_done (common_operation);
+ common_operation = NULL;
+ result = PEERS_CONNECTED;
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Peers connected\n");
+ delayed_connect_task =
+ GNUNET_SCHEDULER_add_delayed (TIME_REL_SECS (3),
+ &do_delayed_connect, NULL);
break;
+ case PEERS_CONNECTED:
+ FAIL_TEST (NULL == peer1.operation);
+ FAIL_TEST (NULL == peer2.operation);
+ FAIL_TEST (NULL != common_operation);
+ GNUNET_TESTBED_operation_done (common_operation);
+ common_operation = NULL;
+ result = PEERS_CONNECTED_2;
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Peers connected again\n");
+ peer1.operation = GNUNET_TESTBED_peer_stop (peer1.peer, NULL, NULL);
+ peer2.operation = GNUNET_TESTBED_peer_stop (peer2.peer, NULL, NULL);
+ break;
default:
FAIL_TEST (0);
}
Modified: gnunet/src/testbed/test_testbed_api_3peers_3controllers.c
===================================================================
--- gnunet/src/testbed/test_testbed_api_3peers_3controllers.c 2013-01-07
16:34:38 UTC (rev 25709)
+++ gnunet/src/testbed/test_testbed_api_3peers_3controllers.c 2013-01-07
16:37:24 UTC (rev 25710)
@@ -264,6 +264,8 @@
if (NULL != hc_handle)
GNUNET_TESTBED_is_host_habitable_cancel (hc_handle);
GNUNET_assert (GNUNET_SCHEDULER_NO_TASK == delayed_connect_task);
+ if (NULL != common_operation)
+ GNUNET_TESTBED_operation_done (common_operation);
if (NULL != reg_handle)
GNUNET_TESTBED_cancel_registration (reg_handle);
if (NULL != controller1)
@@ -360,61 +362,26 @@
abort_test();
return;
}
+
switch(result)
{
case PEER3_STARTED:
- if ((NULL != peer1.operation) ||
- (NULL != peer2.operation) ||
- (NULL == common_operation))
- {
- GNUNET_break (0);
- abort_test();
- return;
- }
- GNUNET_TESTBED_operation_done (common_operation);
- common_operation = NULL;
- result = PEERS_1_2_CONNECTED;
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Peers connected\n");
- common_operation =
- GNUNET_TESTBED_overlay_connect (NULL, &op_comp_cb, NULL, peer2.peer,
- peer3.peer);
- break;
- case PEERS_1_2_CONNECTED:
- if (NULL == common_operation)
- {
- GNUNET_break (0);
- abort_test();
- return;
- }
- GNUNET_TESTBED_operation_done (common_operation);
- common_operation = NULL;
- result = PEERS_2_3_CONNECTED;
- delayed_connect_task =
- GNUNET_SCHEDULER_add_delayed (TIME_REL_SECS (3),
- &do_delayed_connect, NULL);
- break;
case PEERS_2_3_CONNECTED:
- if ((NULL != peer1.operation) ||
- (NULL != peer2.operation) ||
- (NULL == common_operation))
- {
- GNUNET_break (0);
- abort_test();
- return;
- }
- GNUNET_TESTBED_operation_done (common_operation);
- common_operation = NULL;
- result = PEERS_CONNECTED_2;
- LOG (GNUNET_ERROR_TYPE_DEBUG, "Peers connected again\n");
- peer1.operation = GNUNET_TESTBED_peer_stop (peer1.peer, NULL, NULL);
- peer2.operation = GNUNET_TESTBED_peer_stop (peer2.peer, NULL, NULL);
- peer3.operation = GNUNET_TESTBED_peer_stop (peer3.peer, NULL, NULL);
+ case PEERS_1_2_CONNECTED:
break;
default:
GNUNET_break (0);
abort_test();
return;
}
+ if ((NULL != peer1.operation) ||
+ (NULL != peer2.operation) ||
+ (NULL != peer3.operation))
+ {
+ GNUNET_break (0);
+ abort_test();
+ return;
+ }
}
@@ -696,7 +663,8 @@
case GNUNET_TESTBED_ET_CONNECT:
if ((NULL != peer1.operation) ||
(NULL != peer2.operation) ||
- (NULL != peer3.operation))
+ (NULL != peer3.operation) ||
+ (NULL == common_operation))
{
GNUNET_break (0);
abort_test();
@@ -705,34 +673,51 @@
switch (result)
{
case PEER3_STARTED:
- if ((NULL == common_operation) ||
- (event->details.peer_connect.peer1 != peer2.peer) ||
+ if ((event->details.peer_connect.peer1 != peer2.peer) ||
(event->details.peer_connect.peer2 != peer1.peer))
{
GNUNET_break (0);
abort_test();
return;
}
+ GNUNET_TESTBED_operation_done (common_operation);
+ common_operation = NULL;
+ result = PEERS_1_2_CONNECTED;
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Peers connected\n");
+ common_operation =
+ GNUNET_TESTBED_overlay_connect (NULL, &op_comp_cb, NULL, peer2.peer,
+ peer3.peer);
break;
- case PEERS_2_3_CONNECTED:
- if ((NULL == common_operation) ||
- (event->details.peer_connect.peer1 != peer1.peer) ||
- (event->details.peer_connect.peer2 != peer2.peer))
+ case PEERS_1_2_CONNECTED:
+ if ((event->details.peer_connect.peer1 != peer2.peer) ||
+ (event->details.peer_connect.peer2 != peer3.peer))
{
GNUNET_break (0);
abort_test();
return;
}
+ GNUNET_TESTBED_operation_done (common_operation);
+ common_operation = NULL;
+ result = PEERS_2_3_CONNECTED;
+ delayed_connect_task =
+ GNUNET_SCHEDULER_add_delayed (TIME_REL_SECS (3),
+ &do_delayed_connect, NULL);
break;
- case PEERS_1_2_CONNECTED:
- if ((NULL == common_operation) ||
- (event->details.peer_connect.peer1 != peer2.peer) ||
- (event->details.peer_connect.peer2 != peer3.peer))
+ case PEERS_2_3_CONNECTED:
+ if ((event->details.peer_connect.peer1 != peer1.peer) ||
+ (event->details.peer_connect.peer2 != peer2.peer))
{
GNUNET_break (0);
abort_test();
return;
}
+ GNUNET_TESTBED_operation_done (common_operation);
+ common_operation = NULL;
+ result = PEERS_CONNECTED_2;
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Peers connected again\n");
+ peer1.operation = GNUNET_TESTBED_peer_stop (peer1.peer, NULL, NULL);
+ peer2.operation = GNUNET_TESTBED_peer_stop (peer2.peer, NULL, NULL);
+ peer3.operation = GNUNET_TESTBED_peer_stop (peer3.peer, NULL, NULL);
break;
default:
GNUNET_break (0);
Modified: gnunet/src/testbed/testbed_api.c
===================================================================
--- gnunet/src/testbed/testbed_api.c 2013-01-07 16:34:38 UTC (rev 25709)
+++ gnunet/src/testbed/testbed_api.c 2013-01-07 16:37:24 UTC (rev 25710)
@@ -772,6 +772,8 @@
cb_cls = data->cb_cls;
GNUNET_CONTAINER_DLL_remove (opc->c->ocq_head, opc->c->ocq_tail, opc);
opc->state = OPC_STATE_FINISHED;
+ if (NULL != cb)
+ cb (cb_cls, opc->op, NULL);
if (0 !=
((GNUNET_TESTBED_ET_CONNECT | GNUNET_TESTBED_ET_DISCONNECT) &
c->event_mask))
@@ -779,8 +781,6 @@
if (NULL != c->cc)
c->cc (c->cc_cls, &event);
}
- if (NULL != cb)
- cb (cb_cls, opc->op, NULL);
return GNUNET_YES;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r25710 - gnunet/src/testbed,
gnunet <=