aboutsummaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
authorMartin Schanzenbach <schanzen@gnunet.org>2022-12-08 17:52:42 +0900
committerMartin Schanzenbach <schanzen@gnunet.org>2022-12-08 17:52:42 +0900
commit1029772b39c7aab734c43df1188180764ff5c34b (patch)
treecdca60dca1e063a3c35c7e8a97e46e59909749dc /src/transport
parent5c4b060714954a6e4571fe981b333856d2ef4a1b (diff)
downloadgnunet-1029772b39c7aab734c43df1188180764ff5c34b.tar.gz
gnunet-1029772b39c7aab734c43df1188180764ff5c34b.zip
TESTING: Properly handle label allocations
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/test_transport_plugin_cmd_udp_backchannel.c11
-rw-r--r--src/transport/transport-testing-cmds.h9
-rw-r--r--src/transport/transport_api_cmd_backchannel_check.c2
-rw-r--r--src/transport/transport_api_cmd_connecting_peers.c2
-rw-r--r--src/transport/transport_api_cmd_start_peer.c11
-rw-r--r--src/transport/transport_api_cmd_stop_peer.c2
6 files changed, 22 insertions, 15 deletions
diff --git a/src/transport/test_transport_plugin_cmd_udp_backchannel.c b/src/transport/test_transport_plugin_cmd_udp_backchannel.c
index 81445b25e..1bc965848 100644
--- a/src/transport/test_transport_plugin_cmd_udp_backchannel.c
+++ b/src/transport/test_transport_plugin_cmd_udp_backchannel.c
@@ -90,7 +90,7 @@ get_waiting_for_barriers ()
90{ 90{
91 struct GNUNET_TESTING_Barrier *barrier; 91 struct GNUNET_TESTING_Barrier *barrier;
92 92
93 //No Barrier 93 // No Barrier
94 return NULL; 94 return NULL;
95} 95}
96 96
@@ -98,7 +98,8 @@ get_waiting_for_barriers ()
98static void 98static void
99barrier_advanced (const char *barrier_name) 99barrier_advanced (const char *barrier_name)
100{ 100{
101 struct GNUNET_TESTING_Barrier *barrier = GNUNET_TESTING_get_barrier (is, barrier_name); 101 struct GNUNET_TESTING_Barrier *barrier = GNUNET_TESTING_get_barrier (is,
102 barrier_name);
102 103
103 GNUNET_TESTING_finish_attached_cmds (is, barrier); 104 GNUNET_TESTING_finish_attached_cmds (is, barrier);
104} 105}
@@ -329,9 +330,9 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message,
329 ts->write_message = write_message; 330 ts->write_message = write_message;
330 331
331 is = GNUNET_TESTING_run (commands, 332 is = GNUNET_TESTING_run (commands,
332 TIMEOUT, 333 TIMEOUT,
333 &handle_result, 334 &handle_result,
334 ts); 335 ts);
335 336
336} 337}
337 338
diff --git a/src/transport/transport-testing-cmds.h b/src/transport/transport-testing-cmds.h
index 680162563..26933a575 100644
--- a/src/transport/transport-testing-cmds.h
+++ b/src/transport/transport-testing-cmds.h
@@ -109,20 +109,22 @@ struct StartPeerState
109 /** 109 /**
110 * The ip of a node. 110 * The ip of a node.
111 */ 111 */
112 const char *node_ip; 112 char *node_ip;
113 113
114 /** 114 /**
115 * Receive callback 115 * Receive callback
116 */ 116 */
117 struct GNUNET_MQ_MessageHandler *handlers; 117 struct GNUNET_MQ_MessageHandler *handlers;
118 118
119 const char *cfgname; 119 //FIXME documentation
120 char *cfgname;
120 121
121 /** 122 /**
122 * Peer's configuration 123 * Peer's configuration
123 */ 124 */
124 struct GNUNET_CONFIGURATION_Handle *cfg; 125 struct GNUNET_CONFIGURATION_Handle *cfg;
125 126
127 //FIXME documentation
126 struct GNUNET_TESTING_Peer *peer; 128 struct GNUNET_TESTING_Peer *peer;
127 129
128 /** 130 /**
@@ -165,13 +167,14 @@ struct StartPeerState
165 */ 167 */
166 size_t hello_size; 168 size_t hello_size;
167 169
170 /** All of the below: FIXME documentation */
168 char *m; 171 char *m;
169 172
170 char *n; 173 char *n;
171 174
172 char *local_m; 175 char *local_m;
173 176
174 const char *system_label; 177 char *system_label;
175 178
176 /** 179 /**
177 * An unique number to identify the peer 180 * An unique number to identify the peer
diff --git a/src/transport/transport_api_cmd_backchannel_check.c b/src/transport/transport_api_cmd_backchannel_check.c
index 0376275a3..e67d9a79c 100644
--- a/src/transport/transport_api_cmd_backchannel_check.c
+++ b/src/transport/transport_api_cmd_backchannel_check.c
@@ -547,7 +547,7 @@ GNUNET_TRANSPORT_cmd_backchannel_check (const char *label,
547 547
548 struct GNUNET_TESTING_Command cmd = { 548 struct GNUNET_TESTING_Command cmd = {
549 .cls = cs, 549 .cls = cs,
550 .label = label, 550 .label = GNUNET_strdup (label),
551 .run = &backchannel_check_run, 551 .run = &backchannel_check_run,
552 .ac = &cs->ac, 552 .ac = &cs->ac,
553 .cleanup = &backchannel_check_cleanup, 553 .cleanup = &backchannel_check_cleanup,
diff --git a/src/transport/transport_api_cmd_connecting_peers.c b/src/transport/transport_api_cmd_connecting_peers.c
index a6006f698..d610bbcb7 100644
--- a/src/transport/transport_api_cmd_connecting_peers.c
+++ b/src/transport/transport_api_cmd_connecting_peers.c
@@ -254,7 +254,7 @@ GNUNET_TRANSPORT_cmd_connect_peers (const char *label,
254 { 254 {
255 struct GNUNET_TESTING_Command cmd = { 255 struct GNUNET_TESTING_Command cmd = {
256 .cls = cps, 256 .cls = cps,
257 .label = label, 257 .label = GNUNET_strdup (label),
258 .run = &connect_peers_run, 258 .run = &connect_peers_run,
259 .ac = &cps->ac, 259 .ac = &cps->ac,
260 .cleanup = &connect_peers_cleanup, 260 .cleanup = &connect_peers_cleanup,
diff --git a/src/transport/transport_api_cmd_start_peer.c b/src/transport/transport_api_cmd_start_peer.c
index 5dfb820e0..7de1d842e 100644
--- a/src/transport/transport_api_cmd_start_peer.c
+++ b/src/transport/transport_api_cmd_start_peer.c
@@ -386,6 +386,9 @@ start_peer_cleanup (void *cls)
386 GNUNET_CONFIGURATION_destroy (sps->cfg); 386 GNUNET_CONFIGURATION_destroy (sps->cfg);
387 sps->cfg = NULL; 387 sps->cfg = NULL;
388 } 388 }
389 GNUNET_free (sps->cfgname);
390 GNUNET_free (sps->node_ip);
391 GNUNET_free (sps->system_label);
389 GNUNET_free (sps->hello); 392 GNUNET_free (sps->hello);
390 GNUNET_free (sps->connected_peers_map); 393 GNUNET_free (sps->connected_peers_map);
391 GNUNET_free (sps); 394 GNUNET_free (sps);
@@ -449,10 +452,10 @@ GNUNET_TRANSPORT_cmd_start_peer (const char *label,
449 452
450 sps = GNUNET_new (struct StartPeerState); 453 sps = GNUNET_new (struct StartPeerState);
451 sps->no = no; 454 sps->no = no;
452 sps->system_label = system_label; 455 sps->system_label = GNUNET_strdup (system_label);
453 sps->connected_peers_map = connected_peers_map; 456 sps->connected_peers_map = connected_peers_map;
454 sps->cfgname = cfgname; 457 sps->cfgname = GNUNET_strdup (cfgname);
455 sps->node_ip = node_ip; 458 sps->node_ip = GNUNET_strdup (node_ip);
456 sps->notify_connect = notify_connect; 459 sps->notify_connect = notify_connect;
457 sps->broadcast = broadcast; 460 sps->broadcast = broadcast;
458 461
@@ -469,7 +472,7 @@ GNUNET_TRANSPORT_cmd_start_peer (const char *label,
469 472
470 struct GNUNET_TESTING_Command cmd = { 473 struct GNUNET_TESTING_Command cmd = {
471 .cls = sps, 474 .cls = sps,
472 .label = label, 475 .label = GNUNET_strdup (label),
473 .run = &start_peer_run, 476 .run = &start_peer_run,
474 .ac = &sps->ac, 477 .ac = &sps->ac,
475 .cleanup = &start_peer_cleanup, 478 .cleanup = &start_peer_cleanup,
diff --git a/src/transport/transport_api_cmd_stop_peer.c b/src/transport/transport_api_cmd_stop_peer.c
index 4ca730add..04c822155 100644
--- a/src/transport/transport_api_cmd_stop_peer.c
+++ b/src/transport/transport_api_cmd_stop_peer.c
@@ -146,7 +146,7 @@ GNUNET_TRANSPORT_cmd_stop_peer (const char *label,
146 { 146 {
147 struct GNUNET_TESTING_Command cmd = { 147 struct GNUNET_TESTING_Command cmd = {
148 .cls = sps, 148 .cls = sps,
149 .label = label, 149 .label = GNUNET_strdup (label),
150 .run = &stop_peer_run, 150 .run = &stop_peer_run,
151 .cleanup = &stop_peer_cleanup, 151 .cleanup = &stop_peer_cleanup,
152 .traits = &stop_peer_traits 152 .traits = &stop_peer_traits