aboutsummaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-05-04 16:53:00 +0200
committerChristian Grothoff <christian@grothoff.org>2019-05-04 16:53:00 +0200
commit3d2a951fa12546c09809f0a4d7e789ef8e971b03 (patch)
treeda31a75671d613d946be56c200814c8628f1885e /src/transport
parentba33155b4f60b8f8049c4f77e3b7b40e29ae63e2 (diff)
downloadgnunet-3d2a951fa12546c09809f0a4d7e789ef8e971b03.tar.gz
gnunet-3d2a951fa12546c09809f0a4d7e789ef8e971b03.zip
only use mono time in TNG HELLOs
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/gnunet-communicator-udp.c10
-rw-r--r--src/transport/gnunet-service-tng.c36
-rw-r--r--src/transport/transport.h5
-rw-r--r--src/transport/transport_api2_application.c113
4 files changed, 69 insertions, 95 deletions
diff --git a/src/transport/gnunet-communicator-udp.c b/src/transport/gnunet-communicator-udp.c
index 9420b9b5c..1c2063d58 100644
--- a/src/transport/gnunet-communicator-udp.c
+++ b/src/transport/gnunet-communicator-udp.c
@@ -1630,23 +1630,15 @@ sock_read (void *cls)
1630 &ub->sender.public_key)) 1630 &ub->sender.public_key))
1631 { 1631 {
1632 char *addr_s; 1632 char *addr_s;
1633 struct GNUNET_TIME_Absolute expiration;
1634 enum GNUNET_NetworkType nt; 1633 enum GNUNET_NetworkType nt;
1635 1634
1636 addr_s = 1635 addr_s =
1637 sockaddr_to_udpaddr_string ((const struct sockaddr *) &sa, salen); 1636 sockaddr_to_udpaddr_string ((const struct sockaddr *) &sa, salen);
1638 GNUNET_STATISTICS_update (stats, "# broadcasts received", 1, GNUNET_NO); 1637 GNUNET_STATISTICS_update (stats, "# broadcasts received", 1, GNUNET_NO);
1639 /* expire at the broadcast frequency, as then we'll get the next one
1640 * anyway */
1641 expiration = GNUNET_TIME_relative_to_absolute (BROADCAST_FREQUENCY);
1642 /* use our own mechanism to determine network type */ 1638 /* use our own mechanism to determine network type */
1643 nt = 1639 nt =
1644 GNUNET_NT_scanner_get_type (is, (const struct sockaddr *) &sa, salen); 1640 GNUNET_NT_scanner_get_type (is, (const struct sockaddr *) &sa, salen);
1645 GNUNET_TRANSPORT_application_validate (ah, 1641 GNUNET_TRANSPORT_application_validate (ah, &ub->sender, nt, addr_s);
1646 &ub->sender,
1647 expiration,
1648 nt,
1649 addr_s);
1650 GNUNET_free (addr_s); 1642 GNUNET_free (addr_s);
1651 return; 1643 return;
1652 } 1644 }
diff --git a/src/transport/gnunet-service-tng.c b/src/transport/gnunet-service-tng.c
index a8f70986b..95ea102df 100644
--- a/src/transport/gnunet-service-tng.c
+++ b/src/transport/gnunet-service-tng.c
@@ -2546,6 +2546,16 @@ static struct PendingAcknowledgement *pa_tail;
2546 */ 2546 */
2547static unsigned int pa_count; 2547static unsigned int pa_count;
2548 2548
2549/**
2550 * Monotonic time we use for HELLOs generated at this time. TODO: we
2551 * should increase this value from time to time (i.e. whenever a
2552 * `struct AddressListEntry` actually expires), but IF we do this, we
2553 * must also update *all* (remaining) addresses in the PEERSTORE at
2554 * that time! (So for now only increased when the peer is restarted,
2555 * which hopefully roughly matches whenever our addresses change.)
2556 */
2557static struct GNUNET_TIME_Absolute hello_mono_time;
2558
2549 2559
2550/** 2560/**
2551 * Get an offset into the transmission history buffer for `struct 2561 * Get an offset into the transmission history buffer for `struct
@@ -4657,7 +4667,7 @@ store_pi (void *cls)
4657 expiration = GNUNET_TIME_relative_to_absolute (ale->expiration); 4667 expiration = GNUNET_TIME_relative_to_absolute (ale->expiration);
4658 GNUNET_HELLO_sign_address (ale->address, 4668 GNUNET_HELLO_sign_address (ale->address,
4659 ale->nt, 4669 ale->nt,
4660 expiration, 4670 hello_mono_time,
4661 GST_my_private_key, 4671 GST_my_private_key,
4662 &addr, 4672 &addr,
4663 &addr_len); 4673 &addr_len);
@@ -8442,19 +8452,15 @@ check_known_address (void *cls,
8442 * 8452 *
8443 * @param pid peer the @a address is for 8453 * @param pid peer the @a address is for
8444 * @param address an address to reach @a pid (presumably) 8454 * @param address an address to reach @a pid (presumably)
8445 * @param expiration when did @a pid claim @a address will become invalid
8446 */ 8455 */
8447static void 8456static void
8448start_address_validation (const struct GNUNET_PeerIdentity *pid, 8457start_address_validation (const struct GNUNET_PeerIdentity *pid,
8449 const char *address, 8458 const char *address)
8450 struct GNUNET_TIME_Absolute expiration)
8451{ 8459{
8452 struct GNUNET_TIME_Absolute now; 8460 struct GNUNET_TIME_Absolute now;
8453 struct ValidationState *vs; 8461 struct ValidationState *vs;
8454 struct CheckKnownAddressContext ckac = {.address = address, .vs = NULL}; 8462 struct CheckKnownAddressContext ckac = {.address = address, .vs = NULL};
8455 8463
8456 if (0 == GNUNET_TIME_absolute_get_remaining (expiration).rel_value_us)
8457 return; /* expired */
8458 (void) GNUNET_CONTAINER_multipeermap_get_multiple (validation_map, 8464 (void) GNUNET_CONTAINER_multipeermap_get_multiple (validation_map,
8459 pid, 8465 pid,
8460 &check_known_address, 8466 &check_known_address,
@@ -8479,7 +8485,8 @@ start_address_validation (const struct GNUNET_PeerIdentity *pid,
8479 now = GNUNET_TIME_absolute_get (); 8485 now = GNUNET_TIME_absolute_get ();
8480 vs = GNUNET_new (struct ValidationState); 8486 vs = GNUNET_new (struct ValidationState);
8481 vs->pid = *pid; 8487 vs->pid = *pid;
8482 vs->valid_until = expiration; 8488 vs->valid_until =
8489 GNUNET_TIME_relative_to_absolute (ADDRESS_VALIDATION_LIFETIME);
8483 vs->first_challenge_use = now; 8490 vs->first_challenge_use = now;
8484 vs->validation_rtt = GNUNET_TIME_UNIT_FOREVER_REL; 8491 vs->validation_rtt = GNUNET_TIME_UNIT_FOREVER_REL;
8485 GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE, 8492 GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE,
@@ -8524,9 +8531,7 @@ handle_hello (void *cls,
8524 GNUNET_break (0); 8531 GNUNET_break (0);
8525 return; 8532 return;
8526 } 8533 }
8527 start_address_validation (&pr->pid, 8534 start_address_validation (&pr->pid, (const char *) record->value);
8528 (const char *) record->value,
8529 record->expiry);
8530} 8535}
8531 8536
8532 8537
@@ -8602,7 +8607,7 @@ handle_address_consider_verify (
8602 struct TransportClient *tc = cls; 8607 struct TransportClient *tc = cls;
8603 char *address; 8608 char *address;
8604 enum GNUNET_NetworkType nt; 8609 enum GNUNET_NetworkType nt;
8605 struct GNUNET_TIME_Absolute expiration; 8610 struct GNUNET_TIME_Absolute mono_time;
8606 8611
8607 (void) cls; 8612 (void) cls;
8608 // OPTIMIZE-FIXME: checking that we know this address already should 8613 // OPTIMIZE-FIXME: checking that we know this address already should
@@ -8614,13 +8619,13 @@ handle_address_consider_verify (
8614 ntohs (hdr->header.size) - sizeof (*hdr), 8619 ntohs (hdr->header.size) - sizeof (*hdr),
8615 &hdr->peer, 8620 &hdr->peer,
8616 &nt, 8621 &nt,
8617 &expiration); 8622 &mono_time);
8618 if (NULL == address) 8623 if (NULL == address)
8619 { 8624 {
8620 GNUNET_break_op (0); 8625 GNUNET_break_op (0);
8621 return; 8626 return;
8622 } 8627 }
8623 start_address_validation (&hdr->peer, address, expiration); 8628 start_address_validation (&hdr->peer, address);
8624 GNUNET_free (address); 8629 GNUNET_free (address);
8625 GNUNET_SERVICE_client_continue (tc->client); 8630 GNUNET_SERVICE_client_continue (tc->client);
8626} 8631}
@@ -8657,9 +8662,7 @@ handle_request_hello_validation (void *cls,
8657{ 8662{
8658 struct TransportClient *tc = cls; 8663 struct TransportClient *tc = cls;
8659 8664
8660 start_address_validation (&m->peer, 8665 start_address_validation (&m->peer, (const char *) &m[1]);
8661 (const char *) &m[1],
8662 GNUNET_TIME_absolute_ntoh (m->expiration));
8663 GNUNET_SERVICE_client_continue (tc->client); 8666 GNUNET_SERVICE_client_continue (tc->client);
8664} 8667}
8665 8668
@@ -8895,6 +8898,7 @@ run (void *cls,
8895 (void) cls; 8898 (void) cls;
8896 (void) service; 8899 (void) service;
8897 /* setup globals */ 8900 /* setup globals */
8901 hello_mono_time = GNUNET_TIME_absolute_get_monotonic (c);
8898 GST_cfg = c; 8902 GST_cfg = c;
8899 backtalkers = GNUNET_CONTAINER_multipeermap_create (16, GNUNET_YES); 8903 backtalkers = GNUNET_CONTAINER_multipeermap_create (16, GNUNET_YES);
8900 pending_acks = GNUNET_CONTAINER_multishortmap_create (32768, GNUNET_YES); 8904 pending_acks = GNUNET_CONTAINER_multishortmap_create (32768, GNUNET_YES);
diff --git a/src/transport/transport.h b/src/transport/transport.h
index ed89940cc..4ba628112 100644
--- a/src/transport/transport.h
+++ b/src/transport/transport.h
@@ -1203,11 +1203,6 @@ struct RequestHelloValidationMessage
1203 */ 1203 */
1204 struct GNUNET_PeerIdentity peer; 1204 struct GNUNET_PeerIdentity peer;
1205 1205
1206 /**
1207 * When does the address expire?
1208 */
1209 struct GNUNET_TIME_AbsoluteNBO expiration;
1210
1211 /* followed by 0-terminated address to validate */ 1206 /* followed by 0-terminated address to validate */
1212}; 1207};
1213 1208
diff --git a/src/transport/transport_api2_application.c b/src/transport/transport_api2_application.c
index 414a21fe4..49f0f36c7 100644
--- a/src/transport/transport_api2_application.c
+++ b/src/transport/transport_api2_application.c
@@ -29,7 +29,8 @@
29#include "transport.h" 29#include "transport.h"
30 30
31 31
32#define LOG(kind,...) GNUNET_log_from(kind, "transport-application-api", __VA_ARGS__) 32#define LOG(kind, ...) \
33 GNUNET_log_from (kind, "transport-application-api", __VA_ARGS__)
33 34
34 35
35/** 36/**
@@ -132,9 +133,7 @@ force_reconnect (struct GNUNET_TRANSPORT_ApplicationHandle *ch)
132 ch->mq = NULL; 133 ch->mq = NULL;
133 } 134 }
134 ch->backoff = GNUNET_TIME_STD_BACKOFF (ch->backoff); 135 ch->backoff = GNUNET_TIME_STD_BACKOFF (ch->backoff);
135 ch->task = GNUNET_SCHEDULER_add_delayed (ch->backoff, 136 ch->task = GNUNET_SCHEDULER_add_delayed (ch->backoff, &reconnect_task, ch);
136 &reconnect_task,
137 ch);
138} 137}
139 138
140 139
@@ -146,8 +145,7 @@ force_reconnect (struct GNUNET_TRANSPORT_ApplicationHandle *ch)
146 * @param error details about the error 145 * @param error details about the error
147 */ 146 */
148static void 147static void
149error_handler (void *cls, 148error_handler (void *cls, enum GNUNET_MQ_Error error)
150 enum GNUNET_MQ_Error error)
151{ 149{
152 struct GNUNET_TRANSPORT_ApplicationHandle *ch = cls; 150 struct GNUNET_TRANSPORT_ApplicationHandle *ch = cls;
153 151
@@ -179,8 +177,7 @@ transmit_suggestion (void *cls,
179 177
180 if (NULL == ch->mq) 178 if (NULL == ch->mq)
181 return GNUNET_SYSERR; 179 return GNUNET_SYSERR;
182 ev = GNUNET_MQ_msg (m, 180 ev = GNUNET_MQ_msg (m, GNUNET_MESSAGE_TYPE_TRANSPORT_SUGGEST);
183 GNUNET_MESSAGE_TYPE_TRANSPORT_SUGGEST);
184 m->pk = htonl ((uint32_t) sh->pk); 181 m->pk = htonl ((uint32_t) sh->pk);
185 m->bw = sh->bw; 182 m->bw = sh->bw;
186 m->peer = *peer; 183 m->peer = *peer;
@@ -197,16 +194,11 @@ transmit_suggestion (void *cls,
197static void 194static void
198reconnect (struct GNUNET_TRANSPORT_ApplicationHandle *ch) 195reconnect (struct GNUNET_TRANSPORT_ApplicationHandle *ch)
199{ 196{
200 static const struct GNUNET_MQ_MessageHandler handlers[] = { 197 static const struct GNUNET_MQ_MessageHandler handlers[] = {{NULL, 0, 0}};
201 { NULL, 0, 0 }
202 };
203 198
204 GNUNET_assert (NULL == ch->mq); 199 GNUNET_assert (NULL == ch->mq);
205 ch->mq = GNUNET_CLIENT_connect (ch->cfg, 200 ch->mq =
206 "transport", 201 GNUNET_CLIENT_connect (ch->cfg, "transport", handlers, &error_handler, ch);
207 handlers,
208 &error_handler,
209 ch);
210 if (NULL == ch->mq) 202 if (NULL == ch->mq)
211 { 203 {
212 force_reconnect (ch); 204 force_reconnect (ch);
@@ -225,14 +217,14 @@ reconnect (struct GNUNET_TRANSPORT_ApplicationHandle *ch)
225 * @return transport application handle, NULL on error 217 * @return transport application handle, NULL on error
226 */ 218 */
227struct GNUNET_TRANSPORT_ApplicationHandle * 219struct GNUNET_TRANSPORT_ApplicationHandle *
228GNUNET_TRANSPORT_application_init (const struct GNUNET_CONFIGURATION_Handle *cfg) 220GNUNET_TRANSPORT_application_init (
221 const struct GNUNET_CONFIGURATION_Handle *cfg)
229{ 222{
230 struct GNUNET_TRANSPORT_ApplicationHandle *ch; 223 struct GNUNET_TRANSPORT_ApplicationHandle *ch;
231 224
232 ch = GNUNET_new (struct GNUNET_TRANSPORT_ApplicationHandle); 225 ch = GNUNET_new (struct GNUNET_TRANSPORT_ApplicationHandle);
233 ch->cfg = cfg; 226 ch->cfg = cfg;
234 ch->sug_requests = GNUNET_CONTAINER_multipeermap_create (32, 227 ch->sug_requests = GNUNET_CONTAINER_multipeermap_create (32, GNUNET_YES);
235 GNUNET_YES);
236 reconnect (ch); 228 reconnect (ch);
237 return ch; 229 return ch;
238} 230}
@@ -248,9 +240,7 @@ GNUNET_TRANSPORT_application_init (const struct GNUNET_CONFIGURATION_Handle *cfg
248 * @return #GNUNET_OK (continue to iterate) 240 * @return #GNUNET_OK (continue to iterate)
249 */ 241 */
250static int 242static int
251free_sug_handle (void *cls, 243free_sug_handle (void *cls, const struct GNUNET_PeerIdentity *key, void *value)
252 const struct GNUNET_PeerIdentity *key,
253 void *value)
254{ 244{
255 struct GNUNET_TRANSPORT_ApplicationSuggestHandle *cur = value; 245 struct GNUNET_TRANSPORT_ApplicationSuggestHandle *cur = value;
256 246
@@ -265,7 +255,8 @@ free_sug_handle (void *cls,
265 * @param ch handle to release 255 * @param ch handle to release
266 */ 256 */
267void 257void
268GNUNET_TRANSPORT_application_done (struct GNUNET_TRANSPORT_ApplicationHandle *ch) 258GNUNET_TRANSPORT_application_done (
259 struct GNUNET_TRANSPORT_ApplicationHandle *ch)
269{ 260{
270 if (NULL != ch->mq) 261 if (NULL != ch->mq)
271 { 262 {
@@ -299,10 +290,11 @@ GNUNET_TRANSPORT_application_done (struct GNUNET_TRANSPORT_ApplicationHandle *ch
299 * @return suggest handle, NULL if a request is already pending 290 * @return suggest handle, NULL if a request is already pending
300 */ 291 */
301struct GNUNET_TRANSPORT_ApplicationSuggestHandle * 292struct GNUNET_TRANSPORT_ApplicationSuggestHandle *
302GNUNET_TRANSPORT_application_suggest (struct GNUNET_TRANSPORT_ApplicationHandle *ch, 293GNUNET_TRANSPORT_application_suggest (
303 const struct GNUNET_PeerIdentity *peer, 294 struct GNUNET_TRANSPORT_ApplicationHandle *ch,
304 enum GNUNET_MQ_PreferenceKind pk, 295 const struct GNUNET_PeerIdentity *peer,
305 struct GNUNET_BANDWIDTH_Value32NBO bw) 296 enum GNUNET_MQ_PreferenceKind pk,
297 struct GNUNET_BANDWIDTH_Value32NBO bw)
306{ 298{
307 struct GNUNET_TRANSPORT_ApplicationSuggestHandle *s; 299 struct GNUNET_TRANSPORT_ApplicationSuggestHandle *s;
308 300
@@ -311,19 +303,17 @@ GNUNET_TRANSPORT_application_suggest (struct GNUNET_TRANSPORT_ApplicationHandle
311 s->id = *peer; 303 s->id = *peer;
312 s->pk = pk; 304 s->pk = pk;
313 s->bw = bw; 305 s->bw = bw;
314 (void) GNUNET_CONTAINER_multipeermap_put (ch->sug_requests, 306 (void) GNUNET_CONTAINER_multipeermap_put (
315 &s->id, 307 ch->sug_requests,
316 s, 308 &s->id,
317 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); 309 s,
310 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
318 LOG (GNUNET_ERROR_TYPE_DEBUG, 311 LOG (GNUNET_ERROR_TYPE_DEBUG,
319 "Requesting TRANSPORT to suggest address for `%s'\n", 312 "Requesting TRANSPORT to suggest address for `%s'\n",
320 GNUNET_i2s (peer)); 313 GNUNET_i2s (peer));
321 if (NULL == ch->mq) 314 if (NULL == ch->mq)
322 return s; 315 return s;
323 GNUNET_assert (GNUNET_OK == 316 GNUNET_assert (GNUNET_OK == transmit_suggestion (ch, &s->id, s));
324 transmit_suggestion (ch,
325 &s->id,
326 s));
327 return s; 317 return s;
328} 318}
329 319
@@ -334,7 +324,8 @@ GNUNET_TRANSPORT_application_suggest (struct GNUNET_TRANSPORT_ApplicationHandle
334 * @param sh handle to stop 324 * @param sh handle to stop
335 */ 325 */
336void 326void
337GNUNET_TRANSPORT_application_suggest_cancel (struct GNUNET_TRANSPORT_ApplicationSuggestHandle *sh) 327GNUNET_TRANSPORT_application_suggest_cancel (
328 struct GNUNET_TRANSPORT_ApplicationSuggestHandle *sh)
338{ 329{
339 struct GNUNET_TRANSPORT_ApplicationHandle *ch = sh->ch; 330 struct GNUNET_TRANSPORT_ApplicationHandle *ch = sh->ch;
340 struct GNUNET_MQ_Envelope *ev; 331 struct GNUNET_MQ_Envelope *ev;
@@ -343,27 +334,23 @@ GNUNET_TRANSPORT_application_suggest_cancel (struct GNUNET_TRANSPORT_Application
343 LOG (GNUNET_ERROR_TYPE_DEBUG, 334 LOG (GNUNET_ERROR_TYPE_DEBUG,
344 "Telling TRANSPORT we no longer care for an address for `%s'\n", 335 "Telling TRANSPORT we no longer care for an address for `%s'\n",
345 GNUNET_i2s (&sh->id)); 336 GNUNET_i2s (&sh->id));
346 GNUNET_assert (GNUNET_OK == 337 GNUNET_assert (
347 GNUNET_CONTAINER_multipeermap_remove (ch->sug_requests, 338 GNUNET_OK ==
348 &sh->id, 339 GNUNET_CONTAINER_multipeermap_remove (ch->sug_requests, &sh->id, sh));
349 sh));
350 if (NULL == ch->mq) 340 if (NULL == ch->mq)
351 { 341 {
352 GNUNET_free (sh); 342 GNUNET_free (sh);
353 return; 343 return;
354 } 344 }
355 ev = GNUNET_MQ_msg (m, 345 ev = GNUNET_MQ_msg (m, GNUNET_MESSAGE_TYPE_TRANSPORT_SUGGEST_CANCEL);
356 GNUNET_MESSAGE_TYPE_TRANSPORT_SUGGEST_CANCEL);
357 m->pk = htonl ((uint32_t) sh->pk); 346 m->pk = htonl ((uint32_t) sh->pk);
358 m->bw = sh->bw; 347 m->bw = sh->bw;
359 m->peer = sh->id; 348 m->peer = sh->id;
360 GNUNET_MQ_send (ch->mq, 349 GNUNET_MQ_send (ch->mq, ev);
361 ev);
362 GNUNET_free (sh); 350 GNUNET_free (sh);
363} 351}
364 352
365 353
366
367/** 354/**
368 * An application (or a communicator) has received a HELLO (or other address 355 * An application (or a communicator) has received a HELLO (or other address
369 * data of another peer) and wants TRANSPORT to validate that the address is 356 * data of another peer) and wants TRANSPORT to validate that the address is
@@ -374,19 +361,17 @@ GNUNET_TRANSPORT_application_suggest_cancel (struct GNUNET_TRANSPORT_Application
374 * 361 *
375 * @param ch handle 362 * @param ch handle
376 * @param peer identity of the peer we have an address for 363 * @param peer identity of the peer we have an address for
377 * @param expiration when does @a addr expire; used by TRANSPORT to know when
378 * to definitively give up attempting to validate
379 * @param nt network type of @a addr (as claimed by the other peer); 364 * @param nt network type of @a addr (as claimed by the other peer);
380 * used by TRANSPORT to avoid trying @a addr's that really cannot work 365 * used by TRANSPORT to avoid trying @a addr's that really cannot work
381 * due to network type missmatches 366 * due to network type missmatches
382 * @param addr address to validate 367 * @param addr address to validate
383 */ 368 */
384void 369void
385GNUNET_TRANSPORT_application_validate (struct GNUNET_TRANSPORT_ApplicationHandle *ch, 370GNUNET_TRANSPORT_application_validate (
386 const struct GNUNET_PeerIdentity *peer, 371 struct GNUNET_TRANSPORT_ApplicationHandle *ch,
387 struct GNUNET_TIME_Absolute expiration, 372 const struct GNUNET_PeerIdentity *peer,
388 enum GNUNET_NetworkType nt, 373 enum GNUNET_NetworkType nt,
389 const char *addr) 374 const char *addr)
390{ 375{
391 struct GNUNET_MQ_Envelope *ev; 376 struct GNUNET_MQ_Envelope *ev;
392 struct RequestHelloValidationMessage *m; 377 struct RequestHelloValidationMessage *m;
@@ -394,24 +379,22 @@ GNUNET_TRANSPORT_application_validate (struct GNUNET_TRANSPORT_ApplicationHandle
394 379
395 if (NULL == ch->mq) 380 if (NULL == ch->mq)
396 { 381 {
397 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 382 GNUNET_log (
398 "Address validation for %s:%s skipped as transport is not connected\n", 383 GNUNET_ERROR_TYPE_WARNING,
399 GNUNET_i2s (peer), 384 "Address validation for %s:%s skipped as transport is not connected\n",
400 addr); 385 GNUNET_i2s (peer),
386 addr);
401 return; 387 return;
402 } 388 }
403 alen = strlen (addr) + 1; 389 alen = strlen (addr) + 1;
404 ev = GNUNET_MQ_msg_extra (m, 390 ev =
405 alen, 391 GNUNET_MQ_msg_extra (m,
406 GNUNET_MESSAGE_TYPE_TRANSPORT_REQUEST_HELLO_VALIDATION); 392 alen,
393 GNUNET_MESSAGE_TYPE_TRANSPORT_REQUEST_HELLO_VALIDATION);
407 m->peer = *peer; 394 m->peer = *peer;
408 m->expiration = GNUNET_TIME_absolute_hton (expiration);
409 m->nt = htonl ((uint32_t) nt); 395 m->nt = htonl ((uint32_t) nt);
410 memcpy (&m[1], 396 memcpy (&m[1], addr, alen);
411 addr, 397 GNUNET_MQ_send (ch->mq, ev);
412 alen);
413 GNUNET_MQ_send (ch->mq,
414 ev);
415} 398}
416 399
417 400