diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2011-07-13 16:23:41 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2011-07-13 16:23:41 +0000 |
commit | 1d9420ad0782bd03f19800ba34f50437707375a0 (patch) | |
tree | 909b8d2463e94169390cb3a2051a9fba827efcb4 /src/transport/plugin_transport_tcp.c | |
parent | cccf27bb8eed3e178e146f9aa7582d82f3673e2c (diff) | |
download | gnunet-1d9420ad0782bd03f19800ba34f50437707375a0.tar.gz gnunet-1d9420ad0782bd03f19800ba34f50437707375a0.zip |
printer: print ip if dns timeout occurs
Diffstat (limited to 'src/transport/plugin_transport_tcp.c')
-rw-r--r-- | src/transport/plugin_transport_tcp.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index 168a2b344..2a5cfaa8d 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c | |||
@@ -1294,6 +1294,16 @@ struct PrettyPrinterContext | |||
1294 | void *asc_cls; | 1294 | void *asc_cls; |
1295 | 1295 | ||
1296 | /** | 1296 | /** |
1297 | * The address | ||
1298 | */ | ||
1299 | void * addr; | ||
1300 | |||
1301 | /** | ||
1302 | * address length | ||
1303 | */ | ||
1304 | size_t addr_len; | ||
1305 | |||
1306 | /** | ||
1297 | * Port to add after the IP address. | 1307 | * Port to add after the IP address. |
1298 | */ | 1308 | */ |
1299 | uint16_t port; | 1309 | uint16_t port; |
@@ -1314,7 +1324,9 @@ append_port (void *cls, const char *hostname) | |||
1314 | 1324 | ||
1315 | if (hostname == NULL) | 1325 | if (hostname == NULL) |
1316 | { | 1326 | { |
1317 | ppc->asc (ppc->asc_cls, NULL); | 1327 | ret = strdup(tcp_address_to_string(NULL, ppc->addr, ppc->addr_len)); |
1328 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Error in name resolution: `%s'\n",ret); | ||
1329 | ppc->asc (ppc->asc_cls, ret); | ||
1318 | GNUNET_free (ppc); | 1330 | GNUNET_free (ppc); |
1319 | return; | 1331 | return; |
1320 | } | 1332 | } |
@@ -1388,10 +1400,13 @@ tcp_plugin_address_pretty_printer (void *cls, | |||
1388 | asc (asc_cls, NULL); | 1400 | asc (asc_cls, NULL); |
1389 | return; | 1401 | return; |
1390 | } | 1402 | } |
1391 | ppc = GNUNET_malloc (sizeof (struct PrettyPrinterContext)); | 1403 | ppc = GNUNET_malloc (sizeof (struct PrettyPrinterContext) + addrlen); |
1392 | ppc->asc = asc; | 1404 | ppc->asc = asc; |
1393 | ppc->asc_cls = asc_cls; | 1405 | ppc->asc_cls = asc_cls; |
1394 | ppc->port = port; | 1406 | ppc->port = port; |
1407 | ppc->addr = &ppc[1]; | ||
1408 | ppc->addr_len = addrlen; | ||
1409 | memcpy(ppc->addr, addr, addrlen); | ||
1395 | GNUNET_RESOLVER_hostname_get (sb, | 1410 | GNUNET_RESOLVER_hostname_get (sb, |
1396 | sbs, | 1411 | sbs, |
1397 | !numeric, timeout, &append_port, ppc); | 1412 | !numeric, timeout, &append_port, ppc); |