aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-12-05 22:58:48 +0000
committerChristian Grothoff <christian@grothoff.org>2013-12-05 22:58:48 +0000
commit809c58d3d44ce6b4cc151b5fd707d9c3136a7443 (patch)
treec914ac625de5e39bb33511c075dd874d7adc9ce0 /src
parent130b959e0d1ecc64a4a61f27d6afdb3dd73c13f0 (diff)
downloadgnunet-809c58d3d44ce6b4cc151b5fd707d9c3136a7443.tar.gz
gnunet-809c58d3d44ce6b4cc151b5fd707d9c3136a7443.zip
-use modern GNUNET_new, instead of GNUNET_malloc (sizeof
Diffstat (limited to 'src')
-rw-r--r--src/testbed/gnunet-service-testbed_peers.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/testbed/gnunet-service-testbed_peers.c b/src/testbed/gnunet-service-testbed_peers.c
index 9bcb058ea..f1359003d 100644
--- a/src/testbed/gnunet-service-testbed_peers.c
+++ b/src/testbed/gnunet-service-testbed_peers.c
@@ -364,7 +364,7 @@ GST_handle_peer_create (void *cls, struct GNUNET_SERVER_Client *client,
364 364
365 GNUNET_CONFIGURATION_set_value_number (cfg, "PATHS", "PEERID", 365 GNUNET_CONFIGURATION_set_value_number (cfg, "PATHS", "PEERID",
366 (unsigned long long) peer_id); 366 (unsigned long long) peer_id);
367 peer = GNUNET_malloc (sizeof (struct Peer)); 367 peer = GNUNET_new (struct Peer);
368 peer->is_remote = GNUNET_NO; 368 peer->is_remote = GNUNET_NO;
369 peer->details.local.cfg = cfg; 369 peer->details.local.cfg = cfg;
370 peer->id = peer_id; 370 peer->id = peer_id;
@@ -385,9 +385,7 @@ GST_handle_peer_create (void *cls, struct GNUNET_SERVER_Client *client,
385 } 385 }
386 peer->details.local.is_running = GNUNET_NO; 386 peer->details.local.is_running = GNUNET_NO;
387 peer_list_add (peer); 387 peer_list_add (peer);
388 reply = 388 reply = GNUNET_new (struct GNUNET_TESTBED_PeerCreateSuccessEventMessage);
389 GNUNET_malloc (sizeof
390 (struct GNUNET_TESTBED_PeerCreateSuccessEventMessage));
391 reply->header.size = 389 reply->header.size =
392 htons (sizeof (struct GNUNET_TESTBED_PeerCreateSuccessEventMessage)); 390 htons (sizeof (struct GNUNET_TESTBED_PeerCreateSuccessEventMessage));
393 reply->header.type = 391 reply->header.type =
@@ -407,12 +405,12 @@ GST_handle_peer_create (void *cls, struct GNUNET_SERVER_Client *client,
407 GNUNET_SERVER_receive_done (client, GNUNET_OK); 405 GNUNET_SERVER_receive_done (client, GNUNET_OK);
408 return; 406 return;
409 } 407 }
410 peer = GNUNET_malloc (sizeof (struct Peer)); 408 peer = GNUNET_new (struct Peer);
411 peer->is_remote = GNUNET_YES; 409 peer->is_remote = GNUNET_YES;
412 peer->id = peer_id; 410 peer->id = peer_id;
413 peer->details.remote.slave = GST_slave_list[route->dest]; 411 peer->details.remote.slave = GST_slave_list[route->dest];
414 peer->details.remote.remote_host_id = host_id; 412 peer->details.remote.remote_host_id = host_id;
415 fo_ctxt = GNUNET_malloc (sizeof (struct ForwardedOperationContext)); 413 fo_ctxt = GNUNET_new (struct ForwardedOperationContext);
416 GNUNET_SERVER_client_keep (client); 414 GNUNET_SERVER_client_keep (client);
417 fo_ctxt->client = client; 415 fo_ctxt->client = client;
418 fo_ctxt->operation_id = GNUNET_ntohll (msg->operation_id); 416 fo_ctxt->operation_id = GNUNET_ntohll (msg->operation_id);
@@ -465,7 +463,7 @@ GST_handle_peer_destroy (void *cls, struct GNUNET_SERVER_Client *client,
465 if (GNUNET_YES == peer->is_remote) 463 if (GNUNET_YES == peer->is_remote)
466 { 464 {
467 /* Forward the destory message to sub controller */ 465 /* Forward the destory message to sub controller */
468 fopc = GNUNET_malloc (sizeof (struct ForwardedOperationContext)); 466 fopc = GNUNET_new (struct ForwardedOperationContext);
469 GNUNET_SERVER_client_keep (client); 467 GNUNET_SERVER_client_keep (client);
470 fopc->client = client; 468 fopc->client = client;
471 fopc->cls = peer; 469 fopc->cls = peer;
@@ -558,7 +556,7 @@ GST_handle_peer_start (void *cls, struct GNUNET_SERVER_Client *client,
558 peer = GST_peer_list[peer_id]; 556 peer = GST_peer_list[peer_id];
559 if (GNUNET_YES == peer->is_remote) 557 if (GNUNET_YES == peer->is_remote)
560 { 558 {
561 fopc = GNUNET_malloc (sizeof (struct ForwardedOperationContext)); 559 fopc = GNUNET_new (struct ForwardedOperationContext);
562 GNUNET_SERVER_client_keep (client); 560 GNUNET_SERVER_client_keep (client);
563 fopc->client = client; 561 fopc->client = client;
564 fopc->operation_id = GNUNET_ntohll (msg->operation_id); 562 fopc->operation_id = GNUNET_ntohll (msg->operation_id);
@@ -583,7 +581,7 @@ GST_handle_peer_start (void *cls, struct GNUNET_SERVER_Client *client,
583 GNUNET_SERVER_receive_done (client, GNUNET_OK); 581 GNUNET_SERVER_receive_done (client, GNUNET_OK);
584 return; 582 return;
585 } 583 }
586 reply = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_PeerEventMessage)); 584 reply = GNUNET_new (struct GNUNET_TESTBED_PeerEventMessage);
587 reply->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_PEER_EVENT); 585 reply->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_PEER_EVENT);
588 reply->header.size = htons (sizeof (struct GNUNET_TESTBED_PeerEventMessage)); 586 reply->header.size = htons (sizeof (struct GNUNET_TESTBED_PeerEventMessage));
589 reply->event_type = htonl (GNUNET_TESTBED_ET_PEER_START); 587 reply->event_type = htonl (GNUNET_TESTBED_ET_PEER_START);
@@ -627,7 +625,7 @@ GST_handle_peer_stop (void *cls, struct GNUNET_SERVER_Client *client,
627 { 625 {
628 LOG (GNUNET_ERROR_TYPE_DEBUG, "Forwarding PEER_STOP for peer %u\n", 626 LOG (GNUNET_ERROR_TYPE_DEBUG, "Forwarding PEER_STOP for peer %u\n",
629 peer_id); 627 peer_id);
630 fopc = GNUNET_malloc (sizeof (struct ForwardedOperationContext)); 628 fopc = GNUNET_new (struct ForwardedOperationContext);
631 GNUNET_SERVER_client_keep (client); 629 GNUNET_SERVER_client_keep (client);
632 fopc->client = client; 630 fopc->client = client;
633 fopc->operation_id = GNUNET_ntohll (msg->operation_id); 631 fopc->operation_id = GNUNET_ntohll (msg->operation_id);
@@ -654,7 +652,7 @@ GST_handle_peer_stop (void *cls, struct GNUNET_SERVER_Client *client,
654 return; 652 return;
655 } 653 }
656 LOG (GNUNET_ERROR_TYPE_DEBUG, "Peer %u successfully stopped\n", peer_id); 654 LOG (GNUNET_ERROR_TYPE_DEBUG, "Peer %u successfully stopped\n", peer_id);
657 reply = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_PeerEventMessage)); 655 reply = GNUNET_new (struct GNUNET_TESTBED_PeerEventMessage);
658 reply->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_PEER_EVENT); 656 reply->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_PEER_EVENT);
659 reply->header.size = htons (sizeof (struct GNUNET_TESTBED_PeerEventMessage)); 657 reply->header.size = htons (sizeof (struct GNUNET_TESTBED_PeerEventMessage));
660 reply->event_type = htonl (GNUNET_TESTBED_ET_PEER_STOP); 658 reply->event_type = htonl (GNUNET_TESTBED_ET_PEER_STOP);
@@ -703,7 +701,7 @@ GST_handle_peer_get_config (void *cls, struct GNUNET_SERVER_Client *client,
703 if (GNUNET_YES == peer->is_remote) 701 if (GNUNET_YES == peer->is_remote)
704 { 702 {
705 LOG_DEBUG ("Forwarding PEER_GET_CONFIG for peer: %u\n", peer_id); 703 LOG_DEBUG ("Forwarding PEER_GET_CONFIG for peer: %u\n", peer_id);
706 fopc = GNUNET_malloc (sizeof (struct ForwardedOperationContext)); 704 fopc = GNUNET_new (struct ForwardedOperationContext);
707 GNUNET_SERVER_client_keep (client); 705 GNUNET_SERVER_client_keep (client);
708 fopc->client = client; 706 fopc->client = client;
709 fopc->operation_id = GNUNET_ntohll (msg->operation_id); 707 fopc->operation_id = GNUNET_ntohll (msg->operation_id);
@@ -892,7 +890,7 @@ GST_handle_peer_reconfigure (void *cls, struct GNUNET_SERVER_Client *client,
892 if (GNUNET_YES == peer->is_remote) 890 if (GNUNET_YES == peer->is_remote)
893 { 891 {
894 LOG_DEBUG ("Forwarding PEER_RECONFIGURE for peer: %u\n", peer_id); 892 LOG_DEBUG ("Forwarding PEER_RECONFIGURE for peer: %u\n", peer_id);
895 fopc = GNUNET_malloc (sizeof (struct ForwardedOperationContext)); 893 fopc = GNUNET_new (struct ForwardedOperationContext);
896 GNUNET_SERVER_client_keep (client); 894 GNUNET_SERVER_client_keep (client);
897 fopc->client = client; 895 fopc->client = client;
898 fopc->operation_id = op_id; 896 fopc->operation_id = op_id;
@@ -1195,7 +1193,7 @@ GST_handle_manage_peer_service (void *cls, struct GNUNET_SERVER_Client *client,
1195 if (GNUNET_YES == peer->is_remote) 1193 if (GNUNET_YES == peer->is_remote)
1196 { 1194 {
1197 /* Forward the destory message to sub controller */ 1195 /* Forward the destory message to sub controller */
1198 fopc = GNUNET_malloc (sizeof (struct ForwardedOperationContext)); 1196 fopc = GNUNET_new (struct ForwardedOperationContext);
1199 GNUNET_SERVER_client_keep (client); 1197 GNUNET_SERVER_client_keep (client);
1200 fopc->client = client; 1198 fopc->client = client;
1201 fopc->cls = peer; 1199 fopc->cls = peer;
@@ -1376,7 +1374,7 @@ GST_handle_shutdown_peers (void *cls, struct GNUNET_SERVER_Client *client,
1376 GST_clear_fopcq (); 1374 GST_clear_fopcq ();
1377 /* Forward to all slaves which we have started */ 1375 /* Forward to all slaves which we have started */
1378 op_id = GNUNET_ntohll (msg->operation_id); 1376 op_id = GNUNET_ntohll (msg->operation_id);
1379 hc = GNUNET_malloc (sizeof (struct HandlerContext_ShutdownPeers)); 1377 hc = GNUNET_new (struct HandlerContext_ShutdownPeers);
1380 /* FIXME: have a better implementation where we track which slaves are 1378 /* FIXME: have a better implementation where we track which slaves are
1381 started by this controller */ 1379 started by this controller */
1382 for (cnt = 0; cnt < GST_slave_list_size; cnt++) 1380 for (cnt = 0; cnt < GST_slave_list_size; cnt++)
@@ -1388,7 +1386,7 @@ GST_handle_shutdown_peers (void *cls, struct GNUNET_SERVER_Client *client,
1388 continue; 1386 continue;
1389 LOG_DEBUG ("Forwarding SHUTDOWN_PEERS\n"); 1387 LOG_DEBUG ("Forwarding SHUTDOWN_PEERS\n");
1390 hc->nslaves++; 1388 hc->nslaves++;
1391 fo_ctxt = GNUNET_malloc (sizeof (struct ForwardedOperationContext)); 1389 fo_ctxt = GNUNET_new (struct ForwardedOperationContext);
1392 GNUNET_SERVER_client_keep (client); 1390 GNUNET_SERVER_client_keep (client);
1393 fo_ctxt->client = client; 1391 fo_ctxt->client = client;
1394 fo_ctxt->operation_id = op_id; 1392 fo_ctxt->operation_id = op_id;