aboutsummaryrefslogtreecommitdiff
path: root/src/testbed
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2012-08-03 22:34:45 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2012-08-03 22:34:45 +0000
commitc889aa7d68b052637ba7ddf6d4d2606214670ca1 (patch)
treed05bf932de69e69a1a752e054f78b5502fce4d31 /src/testbed
parent79c6c6e40249fc70ee14ed5a7e35b3980c3ce453 (diff)
downloadgnunet-c889aa7d68b052637ba7ddf6d4d2606214670ca1.tar.gz
gnunet-c889aa7d68b052637ba7ddf6d4d2606214670ca1.zip
refined overlay connect and extended test case
Diffstat (limited to 'src/testbed')
-rw-r--r--src/testbed/gnunet-service-testbed.c86
-rw-r--r--src/testbed/test_testbed_api_2peers.c195
-rw-r--r--src/testbed/testbed.h2
-rw-r--r--src/testbed/testbed_api.c67
-rw-r--r--src/testbed/testbed_api_peers.c13
-rw-r--r--src/testbed/testbed_api_peers.h2
6 files changed, 305 insertions, 60 deletions
diff --git a/src/testbed/gnunet-service-testbed.c b/src/testbed/gnunet-service-testbed.c
index 169a9e6c7..a4ff40659 100644
--- a/src/testbed/gnunet-service-testbed.c
+++ b/src/testbed/gnunet-service-testbed.c
@@ -324,6 +324,11 @@ enum OCCState
324struct OverlayConnectContext 324struct OverlayConnectContext
325{ 325{
326 /** 326 /**
327 * The client which has requested for overlay connection
328 */
329 struct GNUNET_SERVER_Client *client;
330
331 /**
327 * peer 1 and peer2 332 * peer 1 and peer2
328 */ 333 */
329 struct Peer * peers[2]; 334 struct Peer * peers[2];
@@ -349,6 +354,11 @@ struct OverlayConnectContext
349 struct GNUNET_PeerIdentity peers_identity[2]; 354 struct GNUNET_PeerIdentity peers_identity[2];
350 355
351 /** 356 /**
357 * The id of the operation responsible for creating this context
358 */
359 uint64_t op_id;
360
361 /**
352 * State information for determining whose HELLOs have been successfully 362 * State information for determining whose HELLOs have been successfully
353 * exchanged 363 * exchanged
354 */ 364 */
@@ -1528,27 +1538,6 @@ handle_peer_get_config (void *cls,
1528 1538
1529 1539
1530/** 1540/**
1531 * Task to be executed when HELLO has been sent
1532 *
1533 * @param cls overlay connect context wrapper
1534 * @param tc the task context from scheduler
1535 */
1536static void
1537overlay_connect_finalize (void *cls,
1538 const struct GNUNET_SCHEDULER_TaskContext *tc)
1539{
1540 struct OverlayConnectContextWrapper *occw = cls;
1541 struct OverlayConnectContext *occ;
1542 unsigned int peer;
1543
1544 peer = occw->peer;
1545 occ = occw->occ;
1546 GNUNET_free (occw);
1547 GNUNET_free (occ->peers_hello[peer ^ 1]);
1548}
1549
1550
1551/**
1552 * Exchanges HELLO of peers among them 1541 * Exchanges HELLO of peers among them
1553 * 1542 *
1554 * @param occ the OverlayConnectContext to look into for HELLO messages 1543 * @param occ the OverlayConnectContext to look into for HELLO messages
@@ -1556,7 +1545,6 @@ overlay_connect_finalize (void *cls,
1556static void 1545static void
1557exchange_hellos (struct OverlayConnectContext *occ) 1546exchange_hellos (struct OverlayConnectContext *occ)
1558{ 1547{
1559 struct OverlayConnectContextWrapper *occw;
1560 unsigned int peer; 1548 unsigned int peer;
1561 1549
1562 GNUNET_assert (NULL != occ->peers_hello[0]); 1550 GNUNET_assert (NULL != occ->peers_hello[0]);
@@ -1564,12 +1552,12 @@ exchange_hellos (struct OverlayConnectContext *occ)
1564 LOG_DEBUG ("Exchanging hellos\n"); 1552 LOG_DEBUG ("Exchanging hellos\n");
1565 for (peer = 0; peer < 2; peer++) 1553 for (peer = 0; peer < 2; peer++)
1566 { 1554 {
1567 occw = GNUNET_malloc (sizeof (struct OverlayConnectContextWrapper));
1568 occw->occ = occ;
1569 occw->peer = peer;
1570 GNUNET_TRANSPORT_offer_hello (occ->peers_transport[peer], 1555 GNUNET_TRANSPORT_offer_hello (occ->peers_transport[peer],
1571 occ->peers_hello[peer ^ 1], 1556 occ->peers_hello[peer ^ 1],
1572 &overlay_connect_finalize, occw); 1557 NULL, NULL);
1558 GNUNET_TRANSPORT_try_connect (occ->peers_transport[peer],
1559 &occ->peers_identity[peer ^ 1]);
1560 GNUNET_free (occ->peers_hello[peer ^ 1]);
1573 } 1561 }
1574} 1562}
1575 1563
@@ -1607,17 +1595,51 @@ hello_update_cb (void *cls, const struct GNUNET_MessageHeader *hello)
1607 * peer connected to us. 1595 * peer connected to us.
1608 * 1596 *
1609 * @param cls closure 1597 * @param cls closure
1610 * @param peer the peer that connected 1598 * @param new_peer the peer that connected
1611 * @param ats performance data 1599 * @param ats performance data
1612 * @param ats_count number of entries in ats (excluding 0-termination) 1600 * @param ats_count number of entries in ats (excluding 0-termination)
1613 */ 1601 */
1614static void 1602static void
1615overlay_connect_notify (void *cls, 1603overlay_connect_notify (void *cls,
1616 const struct GNUNET_PeerIdentity * peer, 1604 const struct GNUNET_PeerIdentity * new_peer,
1617 const struct GNUNET_ATS_Information * ats, 1605 const struct GNUNET_ATS_Information * ats,
1618 uint32_t ats_count) 1606 uint32_t ats_count)
1619{ 1607{
1620 GNUNET_break (0); /* To be implemented */ 1608 struct OverlayConnectContextWrapper *occw = cls;
1609 struct OverlayConnectContext *occ;
1610 struct GNUNET_TESTBED_ConnectionEventMessage *msg;
1611 unsigned int peer;
1612
1613 peer = occw->peer;
1614 occ = occw->occ;
1615 if (0 != memcmp (new_peer, &occ->peers_identity[peer ^ 1],
1616 sizeof (struct GNUNET_PeerIdentity)))
1617 {
1618 LOG_DEBUG ("Unexpected peer %4s connected to peer %4s\n",
1619 GNUNET_i2s (new_peer),
1620 GNUNET_i2s (&occ->peers_identity[peer ^ 1]));
1621 return;
1622 }
1623 GNUNET_free (occw);
1624 LOG_DEBUG ("Peer %4s connected to peer %4s\n", GNUNET_i2s (new_peer),
1625 GNUNET_i2s (&occ->peers_identity[peer ^ 1]));
1626 GNUNET_TRANSPORT_disconnect (occ->peers_transport[peer]);
1627 occ->peers_transport[peer] = NULL;
1628 if (NULL != occ->peers_transport[peer ^ 1])
1629 return;
1630 /* Peers are connected - now send overlay connect success message */
1631 LOG_DEBUG ("Peers connected - Sending overlay connect success\n");
1632 msg = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_ConnectionEventMessage));
1633 msg->header.size = htons (sizeof (struct
1634 GNUNET_TESTBED_ConnectionEventMessage));
1635 msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_PEERCONEVENT);
1636 msg->event_type = htonl (GNUNET_TESTBED_ET_CONNECT);
1637 msg->peer1 = occ->peers[0]->id;
1638 msg->peer2 = occ->peers[1]->id;
1639 msg->operation_id = GNUNET_htonll (occ->op_id);
1640 queue_message (occ->client, &msg->header);
1641 GNUNET_SERVER_client_drop (occ->client);
1642 GNUNET_free (occ);
1621} 1643}
1622 1644
1623 1645
@@ -1648,9 +1670,12 @@ handle_overlay_connect (void *cls,
1648 GNUNET_assert (p2 < peer_list_size); 1670 GNUNET_assert (p2 < peer_list_size);
1649 GNUNET_assert (NULL != peer_list[p2]); 1671 GNUNET_assert (NULL != peer_list[p2]);
1650 occ = GNUNET_malloc (sizeof (struct OverlayConnectContext)); 1672 occ = GNUNET_malloc (sizeof (struct OverlayConnectContext));
1673 GNUNET_SERVER_client_keep (client);
1674 occ->client = client;
1651 occ->state = OCC_STATE_INIT; 1675 occ->state = OCC_STATE_INIT;
1652 occ->peers[0] = peer_list[p1]; 1676 occ->peers[0] = peer_list[p1];
1653 occ->peers[1] = peer_list[p2]; 1677 occ->peers[1] = peer_list[p2];
1678 occ->op_id = GNUNET_ntohll (msg->operation_id);
1654 for (peer = 0; peer < 2; peer++) 1679 for (peer = 0; peer < 2; peer++)
1655 { 1680 {
1656 occw = GNUNET_malloc (sizeof (struct OverlayConnectContextWrapper)); 1681 occw = GNUNET_malloc (sizeof (struct OverlayConnectContextWrapper));
@@ -1666,6 +1691,7 @@ handle_overlay_connect (void *cls,
1666 GNUNET_TRANSPORT_get_hello (occ->peers_transport[peer], 1691 GNUNET_TRANSPORT_get_hello (occ->peers_transport[peer],
1667 &hello_update_cb, occw); 1692 &hello_update_cb, occw);
1668 } 1693 }
1694 GNUNET_SERVER_receive_done (client, GNUNET_OK);
1669} 1695}
1670 1696
1671 1697
diff --git a/src/testbed/test_testbed_api_2peers.c b/src/testbed/test_testbed_api_2peers.c
index c8422ba9d..aff71afe0 100644
--- a/src/testbed/test_testbed_api_2peers.c
+++ b/src/testbed/test_testbed_api_2peers.c
@@ -43,6 +43,28 @@
43#define TIME_REL_SECS(sec) \ 43#define TIME_REL_SECS(sec) \
44 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, sec) 44 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, sec)
45 45
46
47/**
48 * Peer context
49 */
50struct PeerContext
51{
52 /**
53 * The peer handle
54 */
55 struct GNUNET_TESTBED_Peer *peer;
56
57 /**
58 * Operations involving this peer
59 */
60 struct GNUNET_TESTBED_Operation *operation;
61
62 /**
63 * set to GNUNET_YES when peer is started
64 */
65 int is_running;
66};
67
46/** 68/**
47 * Our localhost 69 * Our localhost
48 */ 70 */
@@ -69,9 +91,14 @@ static struct GNUNET_TESTBED_Host *neighbour;
69static struct GNUNET_TESTBED_HostRegistrationHandle *reg_handle; 91static struct GNUNET_TESTBED_HostRegistrationHandle *reg_handle;
70 92
71/** 93/**
72 * Handle for a peer 94 * peer 1
95 */
96static struct PeerContext peer1;
97
98/**
99 * peer2
73 */ 100 */
74static struct GNUNET_TESTBED_Peer *peer; 101static struct PeerContext peer2;
75 102
76/** 103/**
77 * Handle to configuration 104 * Handle to configuration
@@ -79,9 +106,9 @@ static struct GNUNET_TESTBED_Peer *peer;
79static struct GNUNET_CONFIGURATION_Handle *cfg; 106static struct GNUNET_CONFIGURATION_Handle *cfg;
80 107
81/** 108/**
82 * Handle to operation 109 * Handle to operations involving both peers
83 */ 110 */
84static struct GNUNET_TESTBED_Operation *operation; 111static struct GNUNET_TESTBED_Operation *common_operation;
85 112
86/** 113/**
87 * Abort task identifier 114 * Abort task identifier
@@ -89,9 +116,46 @@ static struct GNUNET_TESTBED_Operation *operation;
89static GNUNET_SCHEDULER_TaskIdentifier abort_task; 116static GNUNET_SCHEDULER_TaskIdentifier abort_task;
90 117
91/** 118/**
119 * Different stages in testing
120 */
121enum Stage
122 {
123
124 /**
125 * Initial stage
126 */
127 INIT,
128
129 /**
130 * peers are created
131 */
132 PEERS_CREATED,
133
134 /**
135 * peers are started
136 */
137 PEERS_STARTED,
138
139 /**
140 * peers are connected
141 */
142 PEERS_CONNECTED,
143
144 /**
145 * peers are stopped
146 */
147 PEERS_STOPPED,
148
149 /**
150 * Final success stage
151 */
152 SUCCESS
153 };
154
155/**
92 * The testing result 156 * The testing result
93 */ 157 */
94static int result; 158static enum Stage result;
95 159
96 160
97/** 161/**
@@ -141,15 +205,92 @@ do_abort (void *cls, const const struct GNUNET_SCHEDULER_TaskContext *tc)
141static void 205static void
142controller_cb(void *cls, const struct GNUNET_TESTBED_EventInformation *event) 206controller_cb(void *cls, const struct GNUNET_TESTBED_EventInformation *event)
143{ 207{
144 GNUNET_assert (GNUNET_TESTBED_ET_OPERATION_FINISHED == event->type); 208 switch (event->type)
145 GNUNET_assert (event->details.operation_finished.operation == operation); 209 {
146 GNUNET_assert (NULL == event->details.operation_finished.op_cls); 210 case GNUNET_TESTBED_ET_OPERATION_FINISHED:
147 GNUNET_assert (NULL == event->details.operation_finished.emsg); 211 GNUNET_assert (PEERS_STOPPED == result);
148 GNUNET_assert (GNUNET_TESTBED_PIT_GENERIC == 212 GNUNET_assert (NULL == event->details.operation_finished.op_cls);
149 event->details.operation_finished.pit); 213 GNUNET_assert (NULL == event->details.operation_finished.emsg);
150 GNUNET_assert (NULL == event->details.operation_finished.op_result.generic); 214 GNUNET_assert (GNUNET_TESTBED_PIT_GENERIC ==
151 result = GNUNET_YES; 215 event->details.operation_finished.pit);
152 GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); 216 GNUNET_assert (NULL ==
217 event->details.operation_finished.op_result.generic);
218 if (event->details.operation_finished.operation == peer1.operation)
219 {
220 GNUNET_TESTBED_operation_done (peer1.operation);
221 peer1.operation = NULL;
222 peer1.peer = NULL;
223 }
224 else if (event->details.operation_finished.operation == peer2.operation)
225 {
226 GNUNET_TESTBED_operation_done (peer2.operation);
227 peer2.operation = NULL;
228 peer2.peer = NULL;
229 }
230 else
231 GNUNET_assert (0);
232 result = GNUNET_YES;
233 GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
234 break;
235 case GNUNET_TESTBED_ET_PEER_START:
236 GNUNET_assert (INIT == result);
237 GNUNET_assert (event->details.peer_start.host == host);
238 if (event->details.peer_start.peer == peer1.peer)
239 {
240 peer1.is_running = GNUNET_YES;
241 GNUNET_TESTBED_operation_done (peer1.operation);
242 peer1.operation = NULL;
243 }
244 else if (event->details.peer_start.peer == peer2.peer)
245 {
246 peer2.is_running = GNUNET_YES;
247 GNUNET_TESTBED_operation_done (peer2.operation);
248 peer2.operation = NULL;
249 }
250 else
251 GNUNET_assert (0);
252 if ((GNUNET_YES == peer1.is_running) && (GNUNET_YES == peer2.is_running))
253 {
254 result = PEERS_STARTED;
255 common_operation =
256 GNUNET_TESTBED_overlay_connect (NULL, peer1.peer, peer2.peer);
257 }
258 break;
259 case GNUNET_TESTBED_ET_PEER_STOP:
260 GNUNET_assert (PEERS_CONNECTED == result);
261 if (event->details.peer_stop.peer == peer1.peer)
262 {
263 peer1.is_running = GNUNET_NO;
264 GNUNET_TESTBED_operation_done (peer1.operation);
265 peer1.operation = GNUNET_TESTBED_peer_destroy (peer1.peer);
266 }
267 else if (event->details.peer_stop.peer == peer2.peer)
268 {
269 peer2.is_running = GNUNET_NO;
270 GNUNET_TESTBED_operation_done (peer2.operation);
271 peer2.operation = GNUNET_TESTBED_peer_destroy (peer2.peer);
272 }
273 else
274 GNUNET_assert (0);
275 if ((GNUNET_NO == peer1.is_running) && (GNUNET_NO == peer2.is_running))
276 result = PEERS_STOPPED;
277 break;
278 case GNUNET_TESTBED_ET_CONNECT:
279 GNUNET_assert (PEERS_STARTED == result);
280 GNUNET_assert (NULL == peer1.operation);
281 GNUNET_assert (NULL == peer2.operation);
282 GNUNET_assert (NULL != common_operation);
283 GNUNET_assert ((event->details.peer_connect.peer1 == peer1.peer)
284 && (event->details.peer_connect.peer2 == peer2.peer));
285 GNUNET_TESTBED_operation_done (common_operation);
286 common_operation = NULL;
287 result = PEERS_CONNECTED;
288 peer1.operation = GNUNET_TESTBED_peer_stop (peer1.peer);
289 peer2.operation = GNUNET_TESTBED_peer_stop (peer2.peer);
290 break;
291 default:
292 GNUNET_assert (0);
293 };
153} 294}
154 295
155 296
@@ -166,14 +307,14 @@ static void
166peer_create_cb (void *cls, 307peer_create_cb (void *cls,
167 struct GNUNET_TESTBED_Peer *peer, const char *emsg) 308 struct GNUNET_TESTBED_Peer *peer, const char *emsg)
168{ 309{
169 struct GNUNET_TESTBED_Peer **peer_ptr; 310 struct PeerContext *pc = cls;
170 311
171 peer_ptr = cls; 312 GNUNET_assert (NULL != pc->operation);
172 GNUNET_assert (NULL != peer); 313 GNUNET_assert (NULL != peer);
173 GNUNET_assert (NULL != peer_ptr); 314 GNUNET_assert (NULL == pc->peer);
174 *peer_ptr = peer; 315 pc->peer = peer;
175 operation = GNUNET_TESTBED_peer_destroy (peer); 316 GNUNET_TESTBED_operation_done (pc->operation);
176 GNUNET_assert (NULL != operation); 317 pc->operation = GNUNET_TESTBED_peer_start (pc->peer);
177} 318}
178 319
179 320
@@ -188,8 +329,12 @@ registration_comp (void *cls, const char *emsg)
188{ 329{
189 GNUNET_assert (cls == neighbour); 330 GNUNET_assert (cls == neighbour);
190 reg_handle = NULL; 331 reg_handle = NULL;
191 operation = GNUNET_TESTBED_peer_create (controller, host, cfg, &peer_create_cb, &peer); 332 peer1.operation = GNUNET_TESTBED_peer_create (controller, host, cfg,
192 GNUNET_assert (NULL != operation); 333 &peer_create_cb, &peer1);
334 peer2.operation = GNUNET_TESTBED_peer_create (controller, host, cfg,
335 &peer_create_cb, &peer2);
336 GNUNET_assert (NULL != peer1.operation);
337 GNUNET_assert (NULL != peer2.operation);
193} 338}
194 339
195 340
@@ -262,11 +407,11 @@ int main (int argc, char **argv)
262 struct GNUNET_GETOPT_CommandLineOption options[] = { 407 struct GNUNET_GETOPT_CommandLineOption options[] = {
263 GNUNET_GETOPT_OPTION_END 408 GNUNET_GETOPT_OPTION_END
264 }; 409 };
265 result = GNUNET_SYSERR; 410 result = INIT;
266 ret = GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2, 411 ret = GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2,
267 "test_testbed_api", "nohelp", options, &run, 412 "test_testbed_api", "nohelp", options, &run,
268 NULL); 413 NULL);
269 if ((GNUNET_OK != ret) || (GNUNET_OK != result)) 414 if ((GNUNET_OK != ret) || (SUCCESS != result))
270 return 1; 415 return 1;
271 return 0; 416 return 0;
272} 417}
diff --git a/src/testbed/testbed.h b/src/testbed/testbed.h
index 47a3df5db..d4d081b08 100644
--- a/src/testbed/testbed.h
+++ b/src/testbed/testbed.h
@@ -441,7 +441,7 @@ struct GNUNET_TESTBED_ConnectionEventMessage
441 441
442 /** 442 /**
443 * 'enum GNUNET_TESTBED_EventType' (in NBO); 443 * 'enum GNUNET_TESTBED_EventType' (in NBO);
444 * either GNUNET_TESTBED_ET_PEER_CONNECT or GNUNET_TESTBED_ET_PEER_DISCONNECT. 444 * either GNUNET_TESTBED_ET_CONNECT or GNUNET_TESTBED_ET_DISCONNECT.
445 */ 445 */
446 int32_t event_type GNUNET_PACKED; 446 int32_t event_type GNUNET_PACKED;
447 447
diff --git a/src/testbed/testbed_api.c b/src/testbed/testbed_api.c
index 11b70382c..7ca86ac8d 100644
--- a/src/testbed/testbed_api.c
+++ b/src/testbed/testbed_api.c
@@ -401,6 +401,61 @@ handle_peer_event (struct GNUNET_TESTBED_Controller *c,
401 401
402 402
403/** 403/**
404 * Handler for GNUNET_MESSAGE_TYPE_TESTBED_PEERCONEVENT message from
405 * controller (testbed service)
406 *
407 * @param c the controller handler
408 * @param msg message received
409 * @return GNUNET_YES if we can continue receiving from service; GNUNET_NO if
410 * not
411 */
412static int
413handle_peer_conevent (struct GNUNET_TESTBED_Controller *c,
414 const struct GNUNET_TESTBED_ConnectionEventMessage *msg)
415{
416 struct OperationContext *opc;
417 struct OverlayConnectData *data;
418 struct GNUNET_TESTBED_EventInformation event;
419 uint64_t op_id;
420
421 op_id = GNUNET_ntohll (msg->operation_id);
422 if (NULL == (opc = find_opc (c, op_id)))
423 {
424 LOG_DEBUG ("Operation not found\n");
425 return GNUNET_YES;
426 }
427 data = opc->data;
428 GNUNET_assert (NULL != data);
429 GNUNET_assert ((ntohl (msg->peer1) == data->p1->unique_id)
430 && (ntohl (msg->peer2) == data->p2->unique_id));
431 event.type = (enum GNUNET_TESTBED_EventType) ntohl (msg->event_type);
432 switch (event.type)
433 {
434 case GNUNET_TESTBED_ET_CONNECT:
435 event.details.peer_connect.peer1 = data->p1;
436 event.details.peer_connect.peer2 = data->p2;
437 break;
438 case GNUNET_TESTBED_ET_DISCONNECT:
439 GNUNET_assert (0); /* FIXME: implement */
440 break;
441 default:
442 GNUNET_assert (0); /* Should never reach here */
443 break;
444 }
445 GNUNET_CONTAINER_DLL_remove (opc->c->ocq_head, opc->c->ocq_tail, opc);
446 opc->state = OPC_STATE_FINISHED;
447 GNUNET_free (data);
448 if (0 != ((GNUNET_TESTBED_ET_CONNECT | GNUNET_TESTBED_ET_DISCONNECT)
449 & c->event_mask))
450 {
451 if (NULL != c->cc)
452 c->cc (c->cc_cls, &event);
453 }
454 return GNUNET_YES;
455}
456
457
458/**
404 * Handler for GNUNET_MESSAGE_TYPE_TESTBED_PEERCONFIG message from 459 * Handler for GNUNET_MESSAGE_TYPE_TESTBED_PEERCONFIG message from
405 * controller (testbed service) 460 * controller (testbed service)
406 * 461 *
@@ -554,6 +609,12 @@ message_handler (void *cls, const struct GNUNET_MessageHeader *msg)
554 (c, (const struct GNUNET_TESTBED_PeerConfigurationInformationMessage *) 609 (c, (const struct GNUNET_TESTBED_PeerConfigurationInformationMessage *)
555 msg); 610 msg);
556 break; 611 break;
612 case GNUNET_MESSAGE_TYPE_TESTBED_PEERCONEVENT:
613 GNUNET_assert (msize ==
614 sizeof (struct GNUNET_TESTBED_ConnectionEventMessage));
615 status =
616 handle_peer_conevent (c, (const struct
617 GNUNET_TESTBED_ConnectionEventMessage *) msg);
557 default: 618 default:
558 GNUNET_break (0); 619 GNUNET_break (0);
559 } 620 }
@@ -1356,13 +1417,13 @@ GNUNET_TESTBED_operation_done (struct GNUNET_TESTBED_Operation *operation)
1356 case OP_PEER_START: 1417 case OP_PEER_START:
1357 case OP_PEER_STOP: 1418 case OP_PEER_STOP:
1358 case OP_PEER_INFO: 1419 case OP_PEER_INFO:
1420 case OP_OVERLAY_CONNECT:
1359 GNUNET_TESTBED_operation_release_ (operation); 1421 GNUNET_TESTBED_operation_release_ (operation);
1360 return; 1422 return;
1361 case OP_OVERLAY_CONNECT: 1423 default:
1362 GNUNET_free_non_null (operation->data); 1424 GNUNET_assert (0);
1363 break; 1425 break;
1364 } 1426 }
1365 GNUNET_free (operation);
1366} 1427}
1367 1428
1368 1429
diff --git a/src/testbed/testbed_api_peers.c b/src/testbed/testbed_api_peers.c
index e6d709e0b..380190578 100644
--- a/src/testbed/testbed_api_peers.c
+++ b/src/testbed/testbed_api_peers.c
@@ -23,7 +23,9 @@
23 * @brief management of the knowledge about peers in this library 23 * @brief management of the knowledge about peers in this library
24 * (we know the peer ID, its host, pending operations, etc.) 24 * (we know the peer ID, its host, pending operations, etc.)
25 * @author Christian Grothoff 25 * @author Christian Grothoff
26 * @author Sree Harsha Totakura
26 */ 27 */
28
27#include "platform.h" 29#include "platform.h"
28#include "testbed_api_peers.h" 30#include "testbed_api_peers.h"
29#include "testbed_api.h" 31#include "testbed_api.h"
@@ -321,7 +323,14 @@ opstart_overlay_connect (void *cls)
321static void 323static void
322oprelease_overlay_connect (void *cls) 324oprelease_overlay_connect (void *cls)
323{ 325{
324 GNUNET_break (0); 326 struct OperationContext *opc = cls;
327
328 if (OPC_STATE_FINISHED != opc->state)
329 {
330 GNUNET_free (opc->data);
331 GNUNET_CONTAINER_DLL_remove (opc->c->ocq_head, opc->c->ocq_tail, opc);
332 }
333 GNUNET_free (opc);
325} 334}
326 335
327 336
@@ -631,6 +640,8 @@ GNUNET_TESTBED_overlay_connect (void *op_cls,
631 opc->type = OP_OVERLAY_CONNECT; 640 opc->type = OP_OVERLAY_CONNECT;
632 opc->op = GNUNET_TESTBED_operation_create_ (opc, &opstart_overlay_connect, 641 opc->op = GNUNET_TESTBED_operation_create_ (opc, &opstart_overlay_connect,
633 &oprelease_overlay_connect); 642 &oprelease_overlay_connect);
643 GNUNET_TESTBED_operation_queue_insert_ (opc->c->opq_peer_create,
644 opc->op);
634 return opc->op; 645 return opc->op;
635} 646}
636 647
diff --git a/src/testbed/testbed_api_peers.h b/src/testbed/testbed_api_peers.h
index 72c1c1b58..17db0d3b4 100644
--- a/src/testbed/testbed_api_peers.h
+++ b/src/testbed/testbed_api_peers.h
@@ -22,7 +22,9 @@
22 * @file testbed/testbed_api_peers.h 22 * @file testbed/testbed_api_peers.h
23 * @brief internal API to access the 'peers' subsystem 23 * @brief internal API to access the 'peers' subsystem
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 * @author Sree Harsha Totakura
25 */ 26 */
27
26#ifndef NEW_TESTING_API_PEERS_H 28#ifndef NEW_TESTING_API_PEERS_H
27#define NEW_TESTING_API_PEERS_H 29#define NEW_TESTING_API_PEERS_H
28 30