aboutsummaryrefslogtreecommitdiff
path: root/src/testbed/gnunet-service-testbed.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testbed/gnunet-service-testbed.c')
-rw-r--r--src/testbed/gnunet-service-testbed.c256
1 files changed, 123 insertions, 133 deletions
diff --git a/src/testbed/gnunet-service-testbed.c b/src/testbed/gnunet-service-testbed.c
index e767413ee..56bac51c9 100644
--- a/src/testbed/gnunet-service-testbed.c
+++ b/src/testbed/gnunet-service-testbed.c
@@ -226,7 +226,7 @@ transmit_ready_notify (void *cls, size_t size, void *buf)
226 */ 226 */
227void 227void
228GST_queue_message (struct GNUNET_SERVER_Client *client, 228GST_queue_message (struct GNUNET_SERVER_Client *client,
229 struct GNUNET_MessageHeader *msg) 229 struct GNUNET_MessageHeader *msg)
230{ 230{
231 struct MessageQueue *mq_entry; 231 struct MessageQueue *mq_entry;
232 uint16_t type; 232 uint16_t type;
@@ -324,7 +324,8 @@ static void
324slave_list_add (struct Slave *slave) 324slave_list_add (struct Slave *slave)
325{ 325{
326 if (slave->host_id >= GST_slave_list_size) 326 if (slave->host_id >= GST_slave_list_size)
327 array_grow_large_enough (GST_slave_list, GST_slave_list_size, slave->host_id); 327 array_grow_large_enough (GST_slave_list, GST_slave_list_size,
328 slave->host_id);
328 GNUNET_assert (NULL == GST_slave_list[slave->host_id]); 329 GNUNET_assert (NULL == GST_slave_list[slave->host_id]);
329 GST_slave_list[slave->host_id] = slave; 330 GST_slave_list[slave->host_id] = slave;
330} 331}
@@ -361,7 +362,8 @@ peer_list_remove (struct Peer *peer)
361 while (GST_peer_list_size >= LIST_GROW_STEP) 362 while (GST_peer_list_size >= LIST_GROW_STEP)
362 { 363 {
363 for (id = GST_peer_list_size - 1; 364 for (id = GST_peer_list_size - 1;
364 (id >= GST_peer_list_size - LIST_GROW_STEP) && (id != UINT32_MAX); id--) 365 (id >= GST_peer_list_size - LIST_GROW_STEP) && (id != UINT32_MAX);
366 id--)
365 if (NULL != GST_peer_list[id]) 367 if (NULL != GST_peer_list[id])
366 break; 368 break;
367 if (id != ((GST_peer_list_size - LIST_GROW_STEP) - 1)) 369 if (id != ((GST_peer_list_size - LIST_GROW_STEP) - 1))
@@ -371,7 +373,8 @@ peer_list_remove (struct Peer *peer)
371 if (orig_size == GST_peer_list_size) 373 if (orig_size == GST_peer_list_size)
372 return; 374 return;
373 GST_peer_list = 375 GST_peer_list =
374 GNUNET_realloc (GST_peer_list, sizeof (struct Peer *) * GST_peer_list_size); 376 GNUNET_realloc (GST_peer_list,
377 sizeof (struct Peer *) * GST_peer_list_size);
375} 378}
376 379
377 380
@@ -422,7 +425,7 @@ route_message (uint32_t host_id, const struct GNUNET_MessageHeader *msg)
422 */ 425 */
423void 426void
424GST_send_operation_fail_msg (struct GNUNET_SERVER_Client *client, 427GST_send_operation_fail_msg (struct GNUNET_SERVER_Client *client,
425 uint64_t operation_id, const char *emsg) 428 uint64_t operation_id, const char *emsg)
426{ 429{
427 struct GNUNET_TESTBED_OperationFailureEventMessage *msg; 430 struct GNUNET_TESTBED_OperationFailureEventMessage *msg;
428 uint16_t msize; 431 uint16_t msize;
@@ -471,7 +474,7 @@ send_operation_success_msg (struct GNUNET_SERVER_Client *client,
471 * @param cls the handle to the slave at which the registration is completed 474 * @param cls the handle to the slave at which the registration is completed
472 * @param emsg the error message; NULL if host registration is successful 475 * @param emsg the error message; NULL if host registration is successful
473 */ 476 */
474static void 477static void
475hr_completion (void *cls, const char *emsg); 478hr_completion (void *cls, const char *emsg);
476 479
477 480
@@ -485,18 +488,16 @@ static void
485register_next_host (struct Slave *slave) 488register_next_host (struct Slave *slave)
486{ 489{
487 struct HostRegistration *hr; 490 struct HostRegistration *hr;
488 491
489 hr = slave->hr_dll_head; 492 hr = slave->hr_dll_head;
490 GNUNET_assert (NULL != hr); 493 GNUNET_assert (NULL != hr);
491 GNUNET_assert (NULL == slave->rhandle); 494 GNUNET_assert (NULL == slave->rhandle);
492 LOG (GNUNET_ERROR_TYPE_DEBUG, 495 LOG (GNUNET_ERROR_TYPE_DEBUG, "Registering host %u at %u\n",
493 "Registering host %u at %u\n",
494 GNUNET_TESTBED_host_get_id_ (hr->host), 496 GNUNET_TESTBED_host_get_id_ (hr->host),
495 GNUNET_TESTBED_host_get_id_ (GST_host_list[slave->host_id])); 497 GNUNET_TESTBED_host_get_id_ (GST_host_list[slave->host_id]));
496 slave->rhandle = GNUNET_TESTBED_register_host (slave->controller, 498 slave->rhandle =
497 hr->host, 499 GNUNET_TESTBED_register_host (slave->controller, hr->host, hr_completion,
498 hr_completion, 500 slave);
499 slave);
500} 501}
501 502
502 503
@@ -506,7 +507,7 @@ register_next_host (struct Slave *slave)
506 * @param cls the handle to the slave at which the registration is completed 507 * @param cls the handle to the slave at which the registration is completed
507 * @param emsg the error message; NULL if host registration is successful 508 * @param emsg the error message; NULL if host registration is successful
508 */ 509 */
509static void 510static void
510hr_completion (void *cls, const char *emsg) 511hr_completion (void *cls, const char *emsg)
511{ 512{
512 struct Slave *slave = cls; 513 struct Slave *slave = cls;
@@ -515,13 +516,10 @@ hr_completion (void *cls, const char *emsg)
515 slave->rhandle = NULL; 516 slave->rhandle = NULL;
516 hr = slave->hr_dll_head; 517 hr = slave->hr_dll_head;
517 GNUNET_assert (NULL != hr); 518 GNUNET_assert (NULL != hr);
518 LOG (GNUNET_ERROR_TYPE_DEBUG, 519 LOG (GNUNET_ERROR_TYPE_DEBUG, "Registering host %u at %u successful\n",
519 "Registering host %u at %u successful\n",
520 GNUNET_TESTBED_host_get_id_ (hr->host), 520 GNUNET_TESTBED_host_get_id_ (hr->host),
521 GNUNET_TESTBED_host_get_id_ (GST_host_list[slave->host_id])); 521 GNUNET_TESTBED_host_get_id_ (GST_host_list[slave->host_id]));
522 GNUNET_CONTAINER_DLL_remove (slave->hr_dll_head, 522 GNUNET_CONTAINER_DLL_remove (slave->hr_dll_head, slave->hr_dll_tail, hr);
523 slave->hr_dll_tail,
524 hr);
525 if (NULL != hr->cb) 523 if (NULL != hr->cb)
526 hr->cb (hr->cb_cls, emsg); 524 hr->cb (hr->cb_cls, emsg);
527 GNUNET_free (hr); 525 GNUNET_free (hr);
@@ -534,16 +532,15 @@ hr_completion (void *cls, const char *emsg)
534 * Adds a host registration's request to a slave's registration queue 532 * Adds a host registration's request to a slave's registration queue
535 * 533 *
536 * @param slave the slave controller at which the given host has to be 534 * @param slave the slave controller at which the given host has to be
537 * registered 535 * registered
538 * @param cb the host registration completion callback 536 * @param cb the host registration completion callback
539 * @param cb_cls the closure for the host registration completion callback 537 * @param cb_cls the closure for the host registration completion callback
540 * @param host the host which has to be registered 538 * @param host the host which has to be registered
541 */ 539 */
542void 540void
543GST_queue_host_registration (struct Slave *slave, 541GST_queue_host_registration (struct Slave *slave,
544 GNUNET_TESTBED_HostRegistrationCompletion cb, 542 GNUNET_TESTBED_HostRegistrationCompletion cb,
545 void *cb_cls, 543 void *cb_cls, struct GNUNET_TESTBED_Host *host)
546 struct GNUNET_TESTBED_Host *host)
547{ 544{
548 struct HostRegistration *hr; 545 struct HostRegistration *hr;
549 int call_register; 546 int call_register;
@@ -557,9 +554,7 @@ GST_queue_host_registration (struct Slave *slave,
557 hr->cb_cls = cb_cls; 554 hr->cb_cls = cb_cls;
558 hr->host = host; 555 hr->host = host;
559 call_register = (NULL == slave->hr_dll_head) ? GNUNET_YES : GNUNET_NO; 556 call_register = (NULL == slave->hr_dll_head) ? GNUNET_YES : GNUNET_NO;
560 GNUNET_CONTAINER_DLL_insert_tail (slave->hr_dll_head, 557 GNUNET_CONTAINER_DLL_insert_tail (slave->hr_dll_head, slave->hr_dll_tail, hr);
561 slave->hr_dll_tail,
562 hr);
563 if (GNUNET_YES == call_register) 558 if (GNUNET_YES == call_register)
564 register_next_host (slave); 559 register_next_host (slave);
565} 560}
@@ -606,7 +601,7 @@ lcf_proc_cc (void *cls, const char *emsg)
606 } 601 }
607 return; 602 return;
608 603
609 registration_error: 604registration_error:
610 LOG (GNUNET_ERROR_TYPE_WARNING, "Host registration failed with message: %s\n", 605 LOG (GNUNET_ERROR_TYPE_WARNING, "Host registration failed with message: %s\n",
611 emsg); 606 emsg);
612 lcf->state = FINISHED; 607 lcf->state = FINISHED;
@@ -622,7 +617,7 @@ lcf_proc_cc (void *cls, const char *emsg)
622 */ 617 */
623void 618void
624GST_forwarded_operation_reply_relay (void *cls, 619GST_forwarded_operation_reply_relay (void *cls,
625 const struct GNUNET_MessageHeader *msg) 620 const struct GNUNET_MessageHeader *msg)
626{ 621{
627 struct ForwardedOperationContext *fopc = cls; 622 struct ForwardedOperationContext *fopc = cls;
628 struct GNUNET_MessageHeader *dup_msg; 623 struct GNUNET_MessageHeader *dup_msg;
@@ -648,7 +643,7 @@ GST_forwarded_operation_reply_relay (void *cls,
648 */ 643 */
649void 644void
650GST_forwarded_operation_timeout (void *cls, 645GST_forwarded_operation_timeout (void *cls,
651 const struct GNUNET_SCHEDULER_TaskContext *tc) 646 const struct GNUNET_SCHEDULER_TaskContext *tc)
652{ 647{
653 struct ForwardedOperationContext *fopc = cls; 648 struct ForwardedOperationContext *fopc = cls;
654 649
@@ -730,12 +725,12 @@ lcf_proc_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
730 { 725 {
731 case INIT: 726 case INIT:
732 if (GNUNET_NO == 727 if (GNUNET_NO ==
733 GNUNET_TESTBED_is_host_registered_ (GST_host_list[lcf->delegated_host_id], 728 GNUNET_TESTBED_is_host_registered_ (GST_host_list
729 [lcf->delegated_host_id],
734 lcf->gateway->controller)) 730 lcf->gateway->controller))
735 { 731 {
736 GST_queue_host_registration (lcf->gateway, 732 GST_queue_host_registration (lcf->gateway, lcf_proc_cc, lcf,
737 lcf_proc_cc, lcf, 733 GST_host_list[lcf->delegated_host_id]);
738 GST_host_list[lcf->delegated_host_id]);
739 } 734 }
740 else 735 else
741 { 736 {
@@ -748,9 +743,8 @@ lcf_proc_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
748 GNUNET_TESTBED_is_host_registered_ (GST_host_list[lcf->slave_host_id], 743 GNUNET_TESTBED_is_host_registered_ (GST_host_list[lcf->slave_host_id],
749 lcf->gateway->controller)) 744 lcf->gateway->controller))
750 { 745 {
751 GST_queue_host_registration (lcf->gateway, 746 GST_queue_host_registration (lcf->gateway, lcf_proc_cc, lcf,
752 lcf_proc_cc, lcf, 747 GST_host_list[lcf->slave_host_id]);
753 GST_host_list[lcf->slave_host_id]);
754 } 748 }
755 else 749 else
756 { 750 {
@@ -802,7 +796,7 @@ slave_event_callback (void *cls,
802 struct RegisteredHostContext *rhc; 796 struct RegisteredHostContext *rhc;
803 struct GNUNET_CONFIGURATION_Handle *cfg; 797 struct GNUNET_CONFIGURATION_Handle *cfg;
804 struct GNUNET_TESTBED_Operation *old_op; 798 struct GNUNET_TESTBED_Operation *old_op;
805 799
806 /* We currently only get here when working on RegisteredHostContexts */ 800 /* We currently only get here when working on RegisteredHostContexts */
807 GNUNET_assert (GNUNET_TESTBED_ET_OPERATION_FINISHED == event->type); 801 GNUNET_assert (GNUNET_TESTBED_ET_OPERATION_FINISHED == event->type);
808 rhc = event->details.operation_finished.op_cls; 802 rhc = event->details.operation_finished.op_cls;
@@ -814,11 +808,8 @@ slave_event_callback (void *cls,
814 old_op = rhc->sub_op; 808 old_op = rhc->sub_op;
815 rhc->state = RHC_LINK; 809 rhc->state = RHC_LINK;
816 rhc->sub_op = 810 rhc->sub_op =
817 GNUNET_TESTBED_controller_link (rhc, 811 GNUNET_TESTBED_controller_link (rhc, rhc->gateway->controller,
818 rhc->gateway->controller, 812 rhc->reg_host, rhc->host, cfg,
819 rhc->reg_host,
820 rhc->host,
821 cfg,
822 GNUNET_NO); 813 GNUNET_NO);
823 GNUNET_TESTBED_operation_done (old_op); 814 GNUNET_TESTBED_operation_done (old_op);
824 break; 815 break;
@@ -866,8 +857,8 @@ slave_status_callback (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg,
866 } 857 }
867 slave->controller = 858 slave->controller =
868 GNUNET_TESTBED_controller_connect (cfg, GST_host_list[slave->host_id], 859 GNUNET_TESTBED_controller_connect (cfg, GST_host_list[slave->host_id],
869 event_mask, 860 event_mask, &slave_event_callback,
870 &slave_event_callback, slave); 861 slave);
871 if (NULL != slave->controller) 862 if (NULL != slave->controller)
872 { 863 {
873 send_operation_success_msg (lcc->client, lcc->operation_id); 864 send_operation_success_msg (lcc->client, lcc->operation_id);
@@ -876,14 +867,14 @@ slave_status_callback (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg,
876 else 867 else
877 { 868 {
878 GST_send_operation_fail_msg (lcc->client, lcc->operation_id, 869 GST_send_operation_fail_msg (lcc->client, lcc->operation_id,
879 "Could not connect to delegated controller"); 870 "Could not connect to delegated controller");
880 GNUNET_TESTBED_controller_stop (slave->controller_proc); 871 GNUNET_TESTBED_controller_stop (slave->controller_proc);
881 GST_slave_list[slave->host_id] = NULL; 872 GST_slave_list[slave->host_id] = NULL;
882 GNUNET_free (slave); 873 GNUNET_free (slave);
883 slave = NULL; 874 slave = NULL;
884 } 875 }
885 876
886 clean_lcc: 877clean_lcc:
887 if (NULL != lcc) 878 if (NULL != lcc)
888 { 879 {
889 if (NULL != lcc->client) 880 if (NULL != lcc->client)
@@ -944,15 +935,13 @@ handle_init (void *cls, struct GNUNET_SERVER_Client *client,
944 GST_context->master_ip = GNUNET_strdup (controller_hostname); 935 GST_context->master_ip = GNUNET_strdup (controller_hostname);
945 LOG_DEBUG ("Our IP: %s\n", GST_context->master_ip); 936 LOG_DEBUG ("Our IP: %s\n", GST_context->master_ip);
946 GST_context->system = 937 GST_context->system =
947 GNUNET_TESTING_system_create ("testbed", GST_context->master_ip, hostname); 938 GNUNET_TESTING_system_create ("testbed", GST_context->master_ip,
939 hostname);
948 host = 940 host =
949 GNUNET_TESTBED_host_create_with_id (GST_context->host_id, 941 GNUNET_TESTBED_host_create_with_id (GST_context->host_id,
950 GST_context->master_ip, 942 GST_context->master_ip, NULL, 0);
951 NULL,
952 0);
953 host_list_add (host); 943 host_list_add (host);
954 LOG_DEBUG ("Created master context with host ID: %u\n", 944 LOG_DEBUG ("Created master context with host ID: %u\n", GST_context->host_id);
955 GST_context->host_id);
956 GNUNET_SERVER_receive_done (client, GNUNET_OK); 945 GNUNET_SERVER_receive_done (client, GNUNET_OK);
957} 946}
958 947
@@ -987,8 +976,9 @@ handle_add_host (void *cls, struct GNUNET_SERVER_Client *client,
987 if (0 != username_length) 976 if (0 != username_length)
988 username_length++; 977 username_length++;
989 /* msg must contain hostname */ 978 /* msg must contain hostname */
990 GNUNET_assert (msize > (sizeof (struct GNUNET_TESTBED_AddHostMessage) + 979 GNUNET_assert (msize >
991 username_length + 1)); 980 (sizeof (struct GNUNET_TESTBED_AddHostMessage) +
981 username_length + 1));
992 if (0 != username_length) 982 if (0 != username_length)
993 GNUNET_assert ('\0' == username[username_length - 1]); 983 GNUNET_assert ('\0' == username[username_length - 1]);
994 hostname = username + username_length; 984 hostname = username + username_length;
@@ -1025,8 +1015,7 @@ handle_add_host (void *cls, struct GNUNET_SERVER_Client *client,
1025 } 1015 }
1026 else 1016 else
1027 { 1017 {
1028 LOG_DEBUG ("Added host %u at %u\n", 1018 LOG_DEBUG ("Added host %u at %u\n", host_id, GST_context->host_id);
1029 host_id, GST_context->host_id);
1030 reply = GNUNET_malloc (reply_size); 1019 reply = GNUNET_malloc (reply_size);
1031 } 1020 }
1032 reply->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_ADDHOSTCONFIRM); 1021 reply->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_ADDHOSTCONFIRM);
@@ -1173,15 +1162,16 @@ handle_link_controllers (void *cls, struct GNUNET_SERVER_Client *client,
1173 (NULL == GST_host_list[delegated_host_id])) 1162 (NULL == GST_host_list[delegated_host_id]))
1174 { 1163 {
1175 LOG (GNUNET_ERROR_TYPE_WARNING, 1164 LOG (GNUNET_ERROR_TYPE_WARNING,
1176 "Delegated host %u not registered with us\n", delegated_host_id); 1165 "Delegated host %u not registered with us\n", delegated_host_id);
1177 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 1166 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
1178 return; 1167 return;
1179 } 1168 }
1180 slave_host_id = ntohl (msg->slave_host_id); 1169 slave_host_id = ntohl (msg->slave_host_id);
1181 if ((slave_host_id >= GST_host_list_size) || (NULL == GST_host_list[slave_host_id])) 1170 if ((slave_host_id >= GST_host_list_size) ||
1171 (NULL == GST_host_list[slave_host_id]))
1182 { 1172 {
1183 LOG (GNUNET_ERROR_TYPE_WARNING, "Slave host %u not registered with us\n", 1173 LOG (GNUNET_ERROR_TYPE_WARNING, "Slave host %u not registered with us\n",
1184 slave_host_id); 1174 slave_host_id);
1185 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 1175 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
1186 return; 1176 return;
1187 } 1177 }
@@ -1192,7 +1182,7 @@ handle_link_controllers (void *cls, struct GNUNET_SERVER_Client *client,
1192 return; 1182 return;
1193 } 1183 }
1194 1184
1195 if (slave_host_id == GST_context->host_id) /* Link from us */ 1185 if (slave_host_id == GST_context->host_id) /* Link from us */
1196 { 1186 {
1197 struct Slave *slave; 1187 struct Slave *slave;
1198 struct LinkControllersContext *lcc; 1188 struct LinkControllersContext *lcc;
@@ -1249,14 +1239,14 @@ handle_link_controllers (void *cls, struct GNUNET_SERVER_Client *client,
1249 { 1239 {
1250 slave->controller = 1240 slave->controller =
1251 GNUNET_TESTBED_controller_connect (cfg, GST_host_list[slave->host_id], 1241 GNUNET_TESTBED_controller_connect (cfg, GST_host_list[slave->host_id],
1252 event_mask, 1242 event_mask, &slave_event_callback,
1253 &slave_event_callback, slave); 1243 slave);
1254 slave->cfg = cfg; 1244 slave->cfg = cfg;
1255 if (NULL != slave->controller) 1245 if (NULL != slave->controller)
1256 send_operation_success_msg (client, GNUNET_ntohll (msg->operation_id)); 1246 send_operation_success_msg (client, GNUNET_ntohll (msg->operation_id));
1257 else 1247 else
1258 GST_send_operation_fail_msg (client, GNUNET_ntohll (msg->operation_id), 1248 GST_send_operation_fail_msg (client, GNUNET_ntohll (msg->operation_id),
1259 "Could not connect to delegated controller"); 1249 "Could not connect to delegated controller");
1260 GNUNET_SERVER_receive_done (client, GNUNET_OK); 1250 GNUNET_SERVER_receive_done (client, GNUNET_OK);
1261 return; 1251 return;
1262 } 1252 }
@@ -1266,9 +1256,9 @@ handle_link_controllers (void *cls, struct GNUNET_SERVER_Client *client,
1266 lcc->client = client; 1256 lcc->client = client;
1267 slave->lcc = lcc; 1257 slave->lcc = lcc;
1268 slave->controller_proc = 1258 slave->controller_proc =
1269 GNUNET_TESTBED_controller_start (GST_context->master_ip, 1259 GNUNET_TESTBED_controller_start (GST_context->master_ip,
1270 GST_host_list[slave->host_id], cfg, 1260 GST_host_list[slave->host_id], cfg,
1271 &slave_status_callback, slave); 1261 &slave_status_callback, slave);
1272 GNUNET_CONFIGURATION_destroy (cfg); 1262 GNUNET_CONFIGURATION_destroy (cfg);
1273 new_route = GNUNET_malloc (sizeof (struct Route)); 1263 new_route = GNUNET_malloc (sizeof (struct Route));
1274 new_route->dest = delegated_host_id; 1264 new_route->dest = delegated_host_id;
@@ -1314,11 +1304,11 @@ handle_link_controllers (void *cls, struct GNUNET_SERVER_Client *client,
1314 GNUNET_SERVER_receive_done (client, GNUNET_OK); 1304 GNUNET_SERVER_receive_done (client, GNUNET_OK);
1315 return; 1305 return;
1316 } 1306 }
1317 if ((delegated_host_id < route_list_size) 1307 if ((delegated_host_id < route_list_size) &&
1318 && (NULL != route_list[delegated_host_id])) 1308 (NULL != route_list[delegated_host_id]))
1319 { 1309 {
1320 GNUNET_break_op (0); /* Are you trying to link delegated host twice 1310 GNUNET_break_op (0); /* Are you trying to link delegated host twice
1321 with is subordinate flag set to GNUNET_YES? */ 1311 * with is subordinate flag set to GNUNET_YES? */
1322 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 1312 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
1323 return; 1313 return;
1324 } 1314 }
@@ -1463,7 +1453,7 @@ handle_peer_create (void *cls, struct GNUNET_SERVER_Client *client,
1463 if (UINT32_MAX == peer_id) 1453 if (UINT32_MAX == peer_id)
1464 { 1454 {
1465 GST_send_operation_fail_msg (client, GNUNET_ntohll (msg->operation_id), 1455 GST_send_operation_fail_msg (client, GNUNET_ntohll (msg->operation_id),
1466 "Cannot create peer with given ID"); 1456 "Cannot create peer with given ID");
1467 GNUNET_SERVER_receive_done (client, GNUNET_OK); 1457 GNUNET_SERVER_receive_done (client, GNUNET_OK);
1468 return; 1458 return;
1469 } 1459 }
@@ -1502,16 +1492,13 @@ handle_peer_create (void *cls, struct GNUNET_SERVER_Client *client,
1502 return; 1492 return;
1503 } 1493 }
1504 GNUNET_free (config); 1494 GNUNET_free (config);
1505 GNUNET_CONFIGURATION_set_value_number (cfg, 1495 GNUNET_CONFIGURATION_set_value_number (cfg, "TESTBED", "PEERID",
1506 "TESTBED", 1496 (unsigned long long) peer_id);
1507 "PEERID",
1508 (unsigned long long) peer_id);
1509 peer = GNUNET_malloc (sizeof (struct Peer)); 1497 peer = GNUNET_malloc (sizeof (struct Peer));
1510 peer->is_remote = GNUNET_NO; 1498 peer->is_remote = GNUNET_NO;
1511 peer->details.local.cfg = cfg; 1499 peer->details.local.cfg = cfg;
1512 peer->id = peer_id; 1500 peer->id = peer_id;
1513 LOG_DEBUG ("Creating peer with id: %u\n", 1501 LOG_DEBUG ("Creating peer with id: %u\n", (unsigned int) peer->id);
1514 (unsigned int) peer->id);
1515 peer->details.local.peer = 1502 peer->details.local.peer =
1516 GNUNET_TESTING_peer_configure (GST_context->system, 1503 GNUNET_TESTING_peer_configure (GST_context->system,
1517 peer->details.local.cfg, peer->id, 1504 peer->details.local.cfg, peer->id,
@@ -1559,10 +1546,11 @@ handle_peer_create (void *cls, struct GNUNET_SERVER_Client *client,
1559 GNUNET_SERVER_client_keep (client); 1546 GNUNET_SERVER_client_keep (client);
1560 fo_ctxt->client = client; 1547 fo_ctxt->client = client;
1561 fo_ctxt->operation_id = GNUNET_ntohll (msg->operation_id); 1548 fo_ctxt->operation_id = GNUNET_ntohll (msg->operation_id);
1562 fo_ctxt->cls = peer; //GST_slave_list[route->dest]->controller; 1549 fo_ctxt->cls = peer; //GST_slave_list[route->dest]->controller;
1563 fo_ctxt->type = OP_PEER_CREATE; 1550 fo_ctxt->type = OP_PEER_CREATE;
1564 fo_ctxt->opc = 1551 fo_ctxt->opc =
1565 GNUNET_TESTBED_forward_operation_msg_ (GST_slave_list [route->dest]->controller, 1552 GNUNET_TESTBED_forward_operation_msg_ (GST_slave_list
1553 [route->dest]->controller,
1566 fo_ctxt->operation_id, 1554 fo_ctxt->operation_id,
1567 &msg->header, 1555 &msg->header,
1568 peer_create_success_cb, fo_ctxt); 1556 peer_create_success_cb, fo_ctxt);
@@ -1599,7 +1587,7 @@ handle_peer_destroy (void *cls, struct GNUNET_SERVER_Client *client,
1599 LOG (GNUNET_ERROR_TYPE_ERROR, 1587 LOG (GNUNET_ERROR_TYPE_ERROR,
1600 "Asked to destroy a non existent peer with id: %u\n", peer_id); 1588 "Asked to destroy a non existent peer with id: %u\n", peer_id);
1601 GST_send_operation_fail_msg (client, GNUNET_ntohll (msg->operation_id), 1589 GST_send_operation_fail_msg (client, GNUNET_ntohll (msg->operation_id),
1602 "Peer doesn't exist"); 1590 "Peer doesn't exist");
1603 GNUNET_SERVER_receive_done (client, GNUNET_OK); 1591 GNUNET_SERVER_receive_done (client, GNUNET_OK);
1604 return; 1592 return;
1605 } 1593 }
@@ -1612,12 +1600,12 @@ handle_peer_destroy (void *cls, struct GNUNET_SERVER_Client *client,
1612 fopc->client = client; 1600 fopc->client = client;
1613 fopc->cls = peer; 1601 fopc->cls = peer;
1614 fopc->type = OP_PEER_DESTROY; 1602 fopc->type = OP_PEER_DESTROY;
1615 fopc->operation_id = GNUNET_ntohll (msg->operation_id); 1603 fopc->operation_id = GNUNET_ntohll (msg->operation_id);
1616 fopc->opc = 1604 fopc->opc =
1617 GNUNET_TESTBED_forward_operation_msg_ (peer->details.remote.slave->controller, 1605 GNUNET_TESTBED_forward_operation_msg_ (peer->details.remote.
1606 slave->controller,
1618 fopc->operation_id, &msg->header, 1607 fopc->operation_id, &msg->header,
1619 &peer_destroy_success_cb, 1608 &peer_destroy_success_cb, fopc);
1620 fopc);
1621 fopc->timeout_task = 1609 fopc->timeout_task =
1622 GNUNET_SCHEDULER_add_delayed (TIMEOUT, &GST_forwarded_operation_timeout, 1610 GNUNET_SCHEDULER_add_delayed (TIMEOUT, &GST_forwarded_operation_timeout,
1623 fopc); 1611 fopc);
@@ -1672,7 +1660,8 @@ handle_peer_start (void *cls, struct GNUNET_SERVER_Client *client,
1672 fopc->operation_id = GNUNET_ntohll (msg->operation_id); 1660 fopc->operation_id = GNUNET_ntohll (msg->operation_id);
1673 fopc->type = OP_PEER_START; 1661 fopc->type = OP_PEER_START;
1674 fopc->opc = 1662 fopc->opc =
1675 GNUNET_TESTBED_forward_operation_msg_ (peer->details.remote.slave->controller, 1663 GNUNET_TESTBED_forward_operation_msg_ (peer->details.remote.
1664 slave->controller,
1676 fopc->operation_id, &msg->header, 1665 fopc->operation_id, &msg->header,
1677 &GST_forwarded_operation_reply_relay, 1666 &GST_forwarded_operation_reply_relay,
1678 fopc); 1667 fopc);
@@ -1686,7 +1675,7 @@ handle_peer_start (void *cls, struct GNUNET_SERVER_Client *client,
1686 if (GNUNET_OK != GNUNET_TESTING_peer_start (peer->details.local.peer)) 1675 if (GNUNET_OK != GNUNET_TESTING_peer_start (peer->details.local.peer))
1687 { 1676 {
1688 GST_send_operation_fail_msg (client, GNUNET_ntohll (msg->operation_id), 1677 GST_send_operation_fail_msg (client, GNUNET_ntohll (msg->operation_id),
1689 "Failed to start"); 1678 "Failed to start");
1690 GNUNET_SERVER_receive_done (client, GNUNET_OK); 1679 GNUNET_SERVER_receive_done (client, GNUNET_OK);
1691 return; 1680 return;
1692 } 1681 }
@@ -1726,21 +1715,23 @@ handle_peer_stop (void *cls, struct GNUNET_SERVER_Client *client,
1726 if ((peer_id >= GST_peer_list_size) || (NULL == GST_peer_list[peer_id])) 1715 if ((peer_id >= GST_peer_list_size) || (NULL == GST_peer_list[peer_id]))
1727 { 1716 {
1728 GST_send_operation_fail_msg (client, GNUNET_ntohll (msg->operation_id), 1717 GST_send_operation_fail_msg (client, GNUNET_ntohll (msg->operation_id),
1729 "Peer not found"); 1718 "Peer not found");
1730 GNUNET_SERVER_receive_done (client, GNUNET_OK); 1719 GNUNET_SERVER_receive_done (client, GNUNET_OK);
1731 return; 1720 return;
1732 } 1721 }
1733 peer = GST_peer_list[peer_id]; 1722 peer = GST_peer_list[peer_id];
1734 if (GNUNET_YES == peer->is_remote) 1723 if (GNUNET_YES == peer->is_remote)
1735 { 1724 {
1736 LOG (GNUNET_ERROR_TYPE_DEBUG, "Forwarding PEER_STOP for peer %u\n", peer_id); 1725 LOG (GNUNET_ERROR_TYPE_DEBUG, "Forwarding PEER_STOP for peer %u\n",
1726 peer_id);
1737 fopc = GNUNET_malloc (sizeof (struct ForwardedOperationContext)); 1727 fopc = GNUNET_malloc (sizeof (struct ForwardedOperationContext));
1738 GNUNET_SERVER_client_keep (client); 1728 GNUNET_SERVER_client_keep (client);
1739 fopc->client = client; 1729 fopc->client = client;
1740 fopc->operation_id = GNUNET_ntohll (msg->operation_id); 1730 fopc->operation_id = GNUNET_ntohll (msg->operation_id);
1741 fopc->type = OP_PEER_STOP; 1731 fopc->type = OP_PEER_STOP;
1742 fopc->opc = 1732 fopc->opc =
1743 GNUNET_TESTBED_forward_operation_msg_ (peer->details.remote.slave->controller, 1733 GNUNET_TESTBED_forward_operation_msg_ (peer->details.remote.
1734 slave->controller,
1744 fopc->operation_id, &msg->header, 1735 fopc->operation_id, &msg->header,
1745 &GST_forwarded_operation_reply_relay, 1736 &GST_forwarded_operation_reply_relay,
1746 fopc); 1737 fopc);
@@ -1755,7 +1746,7 @@ handle_peer_stop (void *cls, struct GNUNET_SERVER_Client *client,
1755 { 1746 {
1756 LOG (GNUNET_ERROR_TYPE_WARNING, "Stopping peer %u failed\n", peer_id); 1747 LOG (GNUNET_ERROR_TYPE_WARNING, "Stopping peer %u failed\n", peer_id);
1757 GST_send_operation_fail_msg (client, GNUNET_ntohll (msg->operation_id), 1748 GST_send_operation_fail_msg (client, GNUNET_ntohll (msg->operation_id),
1758 "Peer not running"); 1749 "Peer not running");
1759 GNUNET_SERVER_receive_done (client, GNUNET_OK); 1750 GNUNET_SERVER_receive_done (client, GNUNET_OK);
1760 return; 1751 return;
1761 } 1752 }
@@ -1799,7 +1790,7 @@ handle_peer_get_config (void *cls, struct GNUNET_SERVER_Client *client,
1799 if ((peer_id >= GST_peer_list_size) || (NULL == GST_peer_list[peer_id])) 1790 if ((peer_id >= GST_peer_list_size) || (NULL == GST_peer_list[peer_id]))
1800 { 1791 {
1801 GST_send_operation_fail_msg (client, GNUNET_ntohll (msg->operation_id), 1792 GST_send_operation_fail_msg (client, GNUNET_ntohll (msg->operation_id),
1802 "Peer not found"); 1793 "Peer not found");
1803 GNUNET_SERVER_receive_done (client, GNUNET_OK); 1794 GNUNET_SERVER_receive_done (client, GNUNET_OK);
1804 return; 1795 return;
1805 } 1796 }
@@ -1807,7 +1798,7 @@ handle_peer_get_config (void *cls, struct GNUNET_SERVER_Client *client,
1807 if (GNUNET_YES == peer->is_remote) 1798 if (GNUNET_YES == peer->is_remote)
1808 { 1799 {
1809 struct ForwardedOperationContext *fopc; 1800 struct ForwardedOperationContext *fopc;
1810 1801
1811 LOG_DEBUG ("Forwarding PEER_GET_CONFIG for peer: %u\n", peer_id); 1802 LOG_DEBUG ("Forwarding PEER_GET_CONFIG for peer: %u\n", peer_id);
1812 fopc = GNUNET_malloc (sizeof (struct ForwardedOperationContext)); 1803 fopc = GNUNET_malloc (sizeof (struct ForwardedOperationContext));
1813 GNUNET_SERVER_client_keep (client); 1804 GNUNET_SERVER_client_keep (client);
@@ -1815,14 +1806,15 @@ handle_peer_get_config (void *cls, struct GNUNET_SERVER_Client *client,
1815 fopc->operation_id = GNUNET_ntohll (msg->operation_id); 1806 fopc->operation_id = GNUNET_ntohll (msg->operation_id);
1816 fopc->type = OP_PEER_INFO; 1807 fopc->type = OP_PEER_INFO;
1817 fopc->opc = 1808 fopc->opc =
1818 GNUNET_TESTBED_forward_operation_msg_ (peer->details.remote.slave->controller, 1809 GNUNET_TESTBED_forward_operation_msg_ (peer->details.remote.
1810 slave->controller,
1819 fopc->operation_id, &msg->header, 1811 fopc->operation_id, &msg->header,
1820 &GST_forwarded_operation_reply_relay, 1812 &GST_forwarded_operation_reply_relay,
1821 fopc); 1813 fopc);
1822 fopc->timeout_task = 1814 fopc->timeout_task =
1823 GNUNET_SCHEDULER_add_delayed (TIMEOUT, &GST_forwarded_operation_timeout, 1815 GNUNET_SCHEDULER_add_delayed (TIMEOUT, &GST_forwarded_operation_timeout,
1824 fopc); 1816 fopc);
1825 GNUNET_CONTAINER_DLL_insert_tail (fopcq_head, fopcq_tail, fopc); 1817 GNUNET_CONTAINER_DLL_insert_tail (fopcq_head, fopcq_tail, fopc);
1826 GNUNET_SERVER_receive_done (client, GNUNET_OK); 1818 GNUNET_SERVER_receive_done (client, GNUNET_OK);
1827 return; 1819 return;
1828 } 1820 }
@@ -1858,10 +1850,10 @@ handle_peer_get_config (void *cls, struct GNUNET_SERVER_Client *client,
1858 */ 1850 */
1859static void 1851static void
1860handle_slave_get_config (void *cls, struct GNUNET_SERVER_Client *client, 1852handle_slave_get_config (void *cls, struct GNUNET_SERVER_Client *client,
1861 const struct GNUNET_MessageHeader *message) 1853 const struct GNUNET_MessageHeader *message)
1862{ 1854{
1863 struct GNUNET_TESTBED_SlaveGetConfigurationMessage *msg; 1855 struct GNUNET_TESTBED_SlaveGetConfigurationMessage *msg;
1864 struct Slave *slave; 1856 struct Slave *slave;
1865 struct GNUNET_TESTBED_SlaveConfiguration *reply; 1857 struct GNUNET_TESTBED_SlaveConfiguration *reply;
1866 char *config; 1858 char *config;
1867 char *xconfig; 1859 char *xconfig;
@@ -1885,14 +1877,14 @@ handle_slave_get_config (void *cls, struct GNUNET_SERVER_Client *client,
1885 if (NULL == slave->cfg) 1877 if (NULL == slave->cfg)
1886 { 1878 {
1887 GST_send_operation_fail_msg (client, op_id, 1879 GST_send_operation_fail_msg (client, op_id,
1888 "Configuration not found (slave not started by me)"); 1880 "Configuration not found (slave not started by me)");
1889 GNUNET_SERVER_receive_done (client, GNUNET_OK); 1881 GNUNET_SERVER_receive_done (client, GNUNET_OK);
1890 return; 1882 return;
1891 } 1883 }
1892 config = GNUNET_CONFIGURATION_serialize (slave->cfg, &config_size); 1884 config = GNUNET_CONFIGURATION_serialize (slave->cfg, &config_size);
1893 xconfig_size = GNUNET_TESTBED_compress_config_ (config, config_size, 1885 xconfig_size =
1894 &xconfig); 1886 GNUNET_TESTBED_compress_config_ (config, config_size, &xconfig);
1895 GNUNET_free (config); 1887 GNUNET_free (config);
1896 reply_size = xconfig_size + sizeof (struct GNUNET_TESTBED_SlaveConfiguration); 1888 reply_size = xconfig_size + sizeof (struct GNUNET_TESTBED_SlaveConfiguration);
1897 GNUNET_break (reply_size <= UINT16_MAX); 1889 GNUNET_break (reply_size <= UINT16_MAX);
1898 GNUNET_break (config_size <= UINT16_MAX); 1890 GNUNET_break (config_size <= UINT16_MAX);
@@ -1941,9 +1933,8 @@ ss_map_free_iterator (void *cls, const struct GNUNET_HashCode *key, void *value)
1941 * iterate, 1933 * iterate,
1942 * GNUNET_NO if not. 1934 * GNUNET_NO if not.
1943 */ 1935 */
1944static int 1936static int
1945reghost_free_iterator (void *cls, 1937reghost_free_iterator (void *cls, const struct GNUNET_HashCode *key,
1946 const struct GNUNET_HashCode * key,
1947 void *value) 1938 void *value)
1948{ 1939{
1949 struct Slave *slave = cls; 1940 struct Slave *slave = cls;
@@ -1951,19 +1942,17 @@ reghost_free_iterator (void *cls,
1951 struct ForwardedOverlayConnectContext *focc; 1942 struct ForwardedOverlayConnectContext *focc;
1952 1943
1953 GNUNET_assert (GNUNET_YES == 1944 GNUNET_assert (GNUNET_YES ==
1954 GNUNET_CONTAINER_multihashmap_remove (slave->reghost_map, 1945 GNUNET_CONTAINER_multihashmap_remove (slave->reghost_map, key,
1955 key, value)); 1946 value));
1956 while (NULL != (focc = rhc->focc_dll_head)) 1947 while (NULL != (focc = rhc->focc_dll_head))
1957 { 1948 {
1958 GNUNET_CONTAINER_DLL_remove (rhc->focc_dll_head, 1949 GNUNET_CONTAINER_DLL_remove (rhc->focc_dll_head, rhc->focc_dll_tail, focc);
1959 rhc->focc_dll_tail,
1960 focc);
1961 GST_cleanup_focc (focc); 1950 GST_cleanup_focc (focc);
1962 } 1951 }
1963 if (NULL != rhc->sub_op) 1952 if (NULL != rhc->sub_op)
1964 GNUNET_TESTBED_operation_done (rhc->sub_op); 1953 GNUNET_TESTBED_operation_done (rhc->sub_op);
1965 if (NULL != rhc->client) 1954 if (NULL != rhc->client)
1966 GNUNET_SERVER_client_drop (rhc->client); 1955 GNUNET_SERVER_client_drop (rhc->client);
1967 GNUNET_free (value); 1956 GNUNET_free (value);
1968 return GNUNET_YES; 1957 return GNUNET_YES;
1969} 1958}
@@ -2037,12 +2026,12 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
2037 if (NULL != GST_peer_list[id]) 2026 if (NULL != GST_peer_list[id])
2038 { 2027 {
2039 /* If destroy flag is set it means that this peer should have been 2028 /* If destroy flag is set it means that this peer should have been
2040 destroyed by a context which we destroy before */ 2029 * destroyed by a context which we destroy before */
2041 GNUNET_break (GNUNET_NO == GST_peer_list[id]->destroy_flag); 2030 GNUNET_break (GNUNET_NO == GST_peer_list[id]->destroy_flag);
2042 /* counter should be zero as we free all contexts before */ 2031 /* counter should be zero as we free all contexts before */
2043 GNUNET_break (0 == GST_peer_list[id]->reference_cnt); 2032 GNUNET_break (0 == GST_peer_list[id]->reference_cnt);
2044 if ( (GNUNET_NO == GST_peer_list[id]->is_remote) 2033 if ((GNUNET_NO == GST_peer_list[id]->is_remote) &&
2045 && (GNUNET_YES == GST_peer_list[id]->details.local.is_running)) 2034 (GNUNET_YES == GST_peer_list[id]->details.local.is_running))
2046 GNUNET_TESTING_peer_kill (GST_peer_list[id]->details.local.peer); 2035 GNUNET_TESTING_peer_kill (GST_peer_list[id]->details.local.peer);
2047 } 2036 }
2048 for (id = 0; id < GST_peer_list_size; id++) 2037 for (id = 0; id < GST_peer_list_size; id++)
@@ -2050,8 +2039,8 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
2050 { 2039 {
2051 if (GNUNET_NO == GST_peer_list[id]->is_remote) 2040 if (GNUNET_NO == GST_peer_list[id]->is_remote)
2052 { 2041 {
2053 if (GNUNET_YES == GST_peer_list[id]->details.local.is_running) 2042 if (GNUNET_YES == GST_peer_list[id]->details.local.is_running)
2054 GNUNET_TESTING_peer_wait (GST_peer_list[id]->details.local.peer); 2043 GNUNET_TESTING_peer_wait (GST_peer_list[id]->details.local.peer);
2055 GNUNET_TESTING_peer_destroy (GST_peer_list[id]->details.local.peer); 2044 GNUNET_TESTING_peer_destroy (GST_peer_list[id]->details.local.peer);
2056 GNUNET_CONFIGURATION_destroy (GST_peer_list[id]->details.local.cfg); 2045 GNUNET_CONFIGURATION_destroy (GST_peer_list[id]->details.local.cfg);
2057 } 2046 }
@@ -2073,22 +2062,23 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
2073 if (NULL != GST_slave_list[id]) 2062 if (NULL != GST_slave_list[id])
2074 { 2063 {
2075 struct HostRegistration *hr_entry; 2064 struct HostRegistration *hr_entry;
2076 2065
2077 while (NULL != (hr_entry = GST_slave_list[id]->hr_dll_head)) 2066 while (NULL != (hr_entry = GST_slave_list[id]->hr_dll_head))
2078 { 2067 {
2079 GNUNET_CONTAINER_DLL_remove (GST_slave_list[id]->hr_dll_head, 2068 GNUNET_CONTAINER_DLL_remove (GST_slave_list[id]->hr_dll_head,
2080 GST_slave_list[id]->hr_dll_tail, 2069 GST_slave_list[id]->hr_dll_tail, hr_entry);
2081 hr_entry);
2082 GNUNET_free (hr_entry); 2070 GNUNET_free (hr_entry);
2083 } 2071 }
2084 if (NULL != GST_slave_list[id]->rhandle) 2072 if (NULL != GST_slave_list[id]->rhandle)
2085 GNUNET_TESTBED_cancel_registration (GST_slave_list[id]->rhandle); 2073 GNUNET_TESTBED_cancel_registration (GST_slave_list[id]->rhandle);
2086 (void) GNUNET_CONTAINER_multihashmap_iterate (GST_slave_list[id]->reghost_map, 2074 (void)
2087 reghost_free_iterator, 2075 GNUNET_CONTAINER_multihashmap_iterate (GST_slave_list
2088 GST_slave_list[id]); 2076 [id]->reghost_map,
2077 reghost_free_iterator,
2078 GST_slave_list[id]);
2089 GNUNET_CONTAINER_multihashmap_destroy (GST_slave_list[id]->reghost_map); 2079 GNUNET_CONTAINER_multihashmap_destroy (GST_slave_list[id]->reghost_map);
2090 if (NULL != GST_slave_list[id]->cfg) 2080 if (NULL != GST_slave_list[id]->cfg)
2091 GNUNET_CONFIGURATION_destroy (GST_slave_list[id]->cfg); 2081 GNUNET_CONFIGURATION_destroy (GST_slave_list[id]->cfg);
2092 if (NULL != GST_slave_list[id]->controller) 2082 if (NULL != GST_slave_list[id]->controller)
2093 GNUNET_TESTBED_controller_disconnect (GST_slave_list[id]->controller); 2083 GNUNET_TESTBED_controller_disconnect (GST_slave_list[id]->controller);
2094 if (NULL != GST_slave_list[id]->controller_proc) 2084 if (NULL != GST_slave_list[id]->controller_proc)
@@ -2106,14 +2096,14 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
2106 GST_context = NULL; 2096 GST_context = NULL;
2107 } 2097 }
2108 if (NULL != transmit_handle) 2098 if (NULL != transmit_handle)
2109 GNUNET_SERVER_notify_transmit_ready_cancel (transmit_handle); 2099 GNUNET_SERVER_notify_transmit_ready_cancel (transmit_handle);
2110 while (NULL != (mq_entry = mq_head)) 2100 while (NULL != (mq_entry = mq_head))
2111 { 2101 {
2112 GNUNET_free (mq_entry->msg); 2102 GNUNET_free (mq_entry->msg);
2113 GNUNET_SERVER_client_drop (mq_entry->client); 2103 GNUNET_SERVER_client_drop (mq_entry->client);
2114 GNUNET_CONTAINER_DLL_remove (mq_head, mq_tail, mq_entry); 2104 GNUNET_CONTAINER_DLL_remove (mq_head, mq_tail, mq_entry);
2115 GNUNET_free (mq_entry); 2105 GNUNET_free (mq_entry);
2116 } 2106 }
2117 GNUNET_free_non_null (hostname); 2107 GNUNET_free_non_null (hostname);
2118 GNUNET_CONFIGURATION_destroy (our_config); 2108 GNUNET_CONFIGURATION_destroy (our_config);
2119 /* Free hello cache */ 2109 /* Free hello cache */
@@ -2185,21 +2175,21 @@ testbed_run (void *cls, struct GNUNET_SERVER_Handle *server,
2185 char *logfile; 2175 char *logfile;
2186 unsigned long long num; 2176 unsigned long long num;
2187 2177
2188 if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_filename (cfg, 2178 if (GNUNET_OK ==
2189 "TESTBED", 2179 GNUNET_CONFIGURATION_get_value_filename (cfg, "TESTBED", "LOG_FILE",
2190 "LOG_FILE", 2180 &logfile))
2191 &logfile))
2192 { 2181 {
2193 GNUNET_break (GNUNET_OK == GNUNET_log_setup ("testbed", "DEBUG", logfile)); 2182 GNUNET_break (GNUNET_OK == GNUNET_log_setup ("testbed", "DEBUG", logfile));
2194 GNUNET_free (logfile); 2183 GNUNET_free (logfile);
2195 } 2184 }
2196 GNUNET_assert (GNUNET_OK == 2185 GNUNET_assert (GNUNET_OK ==
2197 GNUNET_CONFIGURATION_get_value_number (cfg, "TESTBED", 2186 GNUNET_CONFIGURATION_get_value_number (cfg, "TESTBED",
2198 "HELLO_CACHE_SIZE", 2187 "HELLO_CACHE_SIZE",
2199 &num)); 2188 &num));
2200 GST_cache_init ((unsigned int) num); 2189 GST_cache_init ((unsigned int) num);
2201 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string 2190 GNUNET_assert (GNUNET_OK ==
2202 (cfg, "testbed", "HOSTNAME", &hostname)); 2191 GNUNET_CONFIGURATION_get_value_string (cfg, "testbed",
2192 "HOSTNAME", &hostname));
2203 our_config = GNUNET_CONFIGURATION_dup (cfg); 2193 our_config = GNUNET_CONFIGURATION_dup (cfg);
2204 GNUNET_SERVER_add_handlers (server, message_handlers); 2194 GNUNET_SERVER_add_handlers (server, message_handlers);
2205 GNUNET_SERVER_disconnect_notify (server, &client_disconnect_cb, NULL); 2195 GNUNET_SERVER_disconnect_notify (server, &client_disconnect_cb, NULL);