aboutsummaryrefslogtreecommitdiff
path: root/src/transport/test_communicator_basic.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/test_communicator_basic.c')
-rw-r--r--src/transport/test_communicator_basic.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/src/transport/test_communicator_basic.c b/src/transport/test_communicator_basic.c
index e2d2eb73c..e3573ac2c 100644
--- a/src/transport/test_communicator_basic.c
+++ b/src/transport/test_communicator_basic.c
@@ -124,6 +124,25 @@ communicator_available_cb (void *cls,
124 address_prefix); 124 address_prefix);
125} 125}
126 126
127static void
128open_queue (void *cls)
129{
130 char *address = cls;
131
132 if (NULL != tc_hs[PEER_A]->c_mq)
133 {
134 queue_est = GNUNET_YES;
135 GNUNET_TRANSPORT_TESTING_transport_communicator_open_queue (tc_hs[PEER_A],
136 &peer_id[PEER_B],
137 address);
138 }
139 else
140 {
141 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
142 &open_queue,
143 address);
144 }
145}
127 146
128static void 147static void
129add_address_cb (void *cls, 148add_address_cb (void *cls,
@@ -144,10 +163,7 @@ add_address_cb (void *cls,
144 if ((0 == strcmp ((char*) cls, cfg_peers_name[PEER_B])) && 163 if ((0 == strcmp ((char*) cls, cfg_peers_name[PEER_B])) &&
145 (GNUNET_NO == queue_est)) 164 (GNUNET_NO == queue_est))
146 { 165 {
147 queue_est = GNUNET_YES; 166 open_queue (address);
148 GNUNET_TRANSPORT_TESTING_transport_communicator_open_queue (tc_hs[PEER_A],
149 &peer_id[PEER_B],
150 address);
151 } 167 }
152} 168}
153 169
@@ -205,7 +221,7 @@ make_payload (size_t payload_size)
205 GNUNET_assert (payload_size >= 8); // So that out timestamp fits 221 GNUNET_assert (payload_size >= 8); // So that out timestamp fits
206 ts = GNUNET_TIME_absolute_get (); 222 ts = GNUNET_TIME_absolute_get ();
207 ts_n = GNUNET_TIME_absolute_hton (ts); 223 ts_n = GNUNET_TIME_absolute_hton (ts);
208 memset (payload, 0, payload_size); 224 memset (payload, 'a', payload_size);
209 memcpy (payload, &ts_n, sizeof (struct GNUNET_TIME_AbsoluteNBO)); 225 memcpy (payload, &ts_n, sizeof (struct GNUNET_TIME_AbsoluteNBO));
210 return payload; 226 return payload;
211} 227}
@@ -351,8 +367,9 @@ add_queue_cb (void *cls,
351 "Queue established, starting test...\n"); 367 "Queue established, starting test...\n");
352 start_short = GNUNET_TIME_absolute_get (); 368 start_short = GNUNET_TIME_absolute_get ();
353 my_tc = tc_h; 369 my_tc = tc_h;
354 if (0 != mtu) 370 if (0 != mtu) /* Message header overhead */
355 long_message_size = mtu - 4; /* Dummy message header overhead */ 371 long_message_size = mtu - sizeof(struct GNUNET_TRANSPORT_SendMessageTo)
372 - sizeof(struct GNUNET_MessageHeader);
356 else 373 else
357 long_message_size = LONG_MESSAGE_SIZE; 374 long_message_size = LONG_MESSAGE_SIZE;
358 phase = TP_BURST_SHORT; 375 phase = TP_BURST_SHORT;