aboutsummaryrefslogtreecommitdiff
path: root/src/testbed
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2012-09-17 10:02:11 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2012-09-17 10:02:11 +0000
commit8db7a5f807389eb3d44faef178f26acddb13be55 (patch)
treecbc5502efdbd046277beedec3c24748a5708f616 /src/testbed
parent4f9da94941393e093634efa3d478ba29cc0ff941 (diff)
downloadgnunet-8db7a5f807389eb3d44faef178f26acddb13be55.tar.gz
gnunet-8db7a5f807389eb3d44faef178f26acddb13be55.zip
fixes and working testcase for 2peers_2controllers
Diffstat (limited to 'src/testbed')
-rw-r--r--src/testbed/gnunet-service-testbed.c15
-rw-r--r--src/testbed/test_testbed_api_2peers_2controllers.c7
2 files changed, 14 insertions, 8 deletions
diff --git a/src/testbed/gnunet-service-testbed.c b/src/testbed/gnunet-service-testbed.c
index 0b4fd12f3..02f2d317a 100644
--- a/src/testbed/gnunet-service-testbed.c
+++ b/src/testbed/gnunet-service-testbed.c
@@ -977,6 +977,8 @@ forwarded_operation_reply_relay (void *cls,
977 uint16_t msize; 977 uint16_t msize;
978 978
979 msize = ntohs (msg->size); 979 msize = ntohs (msg->size);
980 LOG_DEBUG ("Relaying message with type: %u, size: %u\n", ntohs (msg->type),
981 msize);
980 dup_msg = GNUNET_malloc (msize); 982 dup_msg = GNUNET_malloc (msize);
981 (void) memcpy (dup_msg, msg, msize); 983 (void) memcpy (dup_msg, msg, msize);
982 queue_message (fopc->client, dup_msg); 984 queue_message (fopc->client, dup_msg);
@@ -2134,7 +2136,7 @@ send_hello (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
2134 msg = GNUNET_malloc (msize); 2136 msg = GNUNET_malloc (msize);
2135 msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_REQUESTCONNECT); 2137 msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_REQUESTCONNECT);
2136 msg->header.size = htons (msize); 2138 msg->header.size = htons (msize);
2137 msg->peer = htonl (occ->peer->id); 2139 msg->peer = htonl (occ->other_peer->id);
2138 msg->operation_id = GNUNET_htonll (occ->op_id); 2140 msg->operation_id = GNUNET_htonll (occ->op_id);
2139 (void) memcpy (&msg->peer_identity, &occ->peer_identity, 2141 (void) memcpy (&msg->peer_identity, &occ->peer_identity,
2140 sizeof (struct GNUNET_PeerIdentity)); 2142 sizeof (struct GNUNET_PeerIdentity));
@@ -2148,11 +2150,11 @@ send_hello (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
2148 GNUNET_i2s (&occ->peer_identity), other_peer_str); 2150 GNUNET_i2s (&occ->peer_identity), other_peer_str);
2149 GNUNET_TRANSPORT_offer_hello (occ->p2th, occ->hello, NULL, NULL); 2151 GNUNET_TRANSPORT_offer_hello (occ->p2th, occ->hello, NULL, NULL);
2150 GNUNET_TRANSPORT_try_connect (occ->p2th, &occ->peer_identity); 2152 GNUNET_TRANSPORT_try_connect (occ->p2th, &occ->peer_identity);
2153 occ->send_hello_task =
2154 GNUNET_SCHEDULER_add_delayed (TRANSPORT_TRY_CONNECT_TIMEOUT,
2155 &send_hello, occ);
2151 } 2156 }
2152 GNUNET_free (other_peer_str); 2157 GNUNET_free (other_peer_str);
2153 occ->send_hello_task =
2154 GNUNET_SCHEDULER_add_delayed (TRANSPORT_TRY_CONNECT_TIMEOUT,
2155 &send_hello, occ);
2156} 2158}
2157 2159
2158/** 2160/**
@@ -2371,6 +2373,7 @@ handle_overlay_connect (void *cls, struct GNUNET_SERVER_Client *client,
2371 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply 2373 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
2372 (GNUNET_TIME_UNIT_SECONDS, 30), 2374 (GNUNET_TIME_UNIT_SECONDS, 30),
2373 &timeout_overlay_connect, occ); 2375 &timeout_overlay_connect, occ);
2376 GNUNET_SERVER_receive_done (client, GNUNET_OK);
2374 return; 2377 return;
2375 } 2378 }
2376 GNUNET_TESTING_peer_get_identity (occ->other_peer->details.local.peer, 2379 GNUNET_TESTING_peer_get_identity (occ->other_peer->details.local.peer,
@@ -2710,7 +2713,7 @@ testbed_run (void *cls, struct GNUNET_SERVER_Handle *server,
2710 {&handle_overlay_connect, NULL, GNUNET_MESSAGE_TYPE_TESTBED_OLCONNECT, 2713 {&handle_overlay_connect, NULL, GNUNET_MESSAGE_TYPE_TESTBED_OLCONNECT,
2711 sizeof (struct GNUNET_TESTBED_OverlayConnectMessage)}, 2714 sizeof (struct GNUNET_TESTBED_OverlayConnectMessage)},
2712 {&handle_overlay_request_connect, NULL, GNUNET_MESSAGE_TYPE_TESTBED_REQUESTCONNECT, 2715 {&handle_overlay_request_connect, NULL, GNUNET_MESSAGE_TYPE_TESTBED_REQUESTCONNECT,
2713 sizeof (struct GNUNET_TESTBED_OverlayConnectMessage)}, 2716 0},
2714 {NULL} 2717 {NULL}
2715 }; 2718 };
2716 2719
diff --git a/src/testbed/test_testbed_api_2peers_2controllers.c b/src/testbed/test_testbed_api_2peers_2controllers.c
index c702dde01..e2d894c82 100644
--- a/src/testbed/test_testbed_api_2peers_2controllers.c
+++ b/src/testbed/test_testbed_api_2peers_2controllers.c
@@ -230,6 +230,7 @@ do_shutdown (void *cls, const const struct GNUNET_SCHEDULER_TaskContext *tc)
230 if (NULL != cp2) 230 if (NULL != cp2)
231 GNUNET_TESTBED_controller_stop (cp2); 231 GNUNET_TESTBED_controller_stop (cp2);
232 GNUNET_TESTBED_host_destroy (host); 232 GNUNET_TESTBED_host_destroy (host);
233 GNUNET_TESTBED_host_destroy (neighbour);
233} 234}
234 235
235 236
@@ -456,18 +457,20 @@ controller_cb (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
456 { 457 {
457 peer1.is_running = GNUNET_NO; 458 peer1.is_running = GNUNET_NO;
458 GNUNET_TESTBED_operation_done (peer1.operation); 459 GNUNET_TESTBED_operation_done (peer1.operation);
459 peer1.operation = GNUNET_TESTBED_peer_destroy (peer1.peer);
460 } 460 }
461 else if (event->details.peer_stop.peer == peer2.peer) 461 else if (event->details.peer_stop.peer == peer2.peer)
462 { 462 {
463 peer2.is_running = GNUNET_NO; 463 peer2.is_running = GNUNET_NO;
464 GNUNET_TESTBED_operation_done (peer2.operation); 464 GNUNET_TESTBED_operation_done (peer2.operation);
465 peer2.operation = GNUNET_TESTBED_peer_destroy (peer2.peer);
466 } 465 }
467 else 466 else
468 GNUNET_assert (0); 467 GNUNET_assert (0);
469 if ((GNUNET_NO == peer1.is_running) && (GNUNET_NO == peer2.is_running)) 468 if ((GNUNET_NO == peer1.is_running) && (GNUNET_NO == peer2.is_running))
469 {
470 result = PEERS_STOPPED; 470 result = PEERS_STOPPED;
471 peer1.operation = GNUNET_TESTBED_peer_destroy (peer1.peer);
472 peer2.operation = GNUNET_TESTBED_peer_destroy (peer2.peer);
473 }
471 break; 474 break;
472 case GNUNET_TESTBED_ET_CONNECT: 475 case GNUNET_TESTBED_ET_CONNECT:
473 switch (result) 476 switch (result)