diff options
Diffstat (limited to 'src/transport/plugin_transport_http.c')
-rw-r--r-- | src/transport/plugin_transport_http.c | 263 |
1 files changed, 160 insertions, 103 deletions
diff --git a/src/transport/plugin_transport_http.c b/src/transport/plugin_transport_http.c index 784dd3002..9008b958d 100644 --- a/src/transport/plugin_transport_http.c +++ b/src/transport/plugin_transport_http.c | |||
@@ -155,18 +155,20 @@ http_plugin_address_pretty_printer (void *cls, const char *type, | |||
155 | struct PrettyPrinterContext *ppc; | 155 | struct PrettyPrinterContext *ppc; |
156 | const void *sb; | 156 | const void *sb; |
157 | size_t sbs; | 157 | size_t sbs; |
158 | uint16_t port = 0 ; | 158 | uint16_t port = 0; |
159 | 159 | ||
160 | if (addrlen == sizeof (struct IPv6HttpAddress)) | 160 | if (addrlen == sizeof (struct IPv6HttpAddress)) |
161 | { | 161 | { |
162 | struct IPv6HttpAddress * a6 = (struct IPv6HttpAddress *) addr; | 162 | struct IPv6HttpAddress *a6 = (struct IPv6HttpAddress *) addr; |
163 | |||
163 | sb = &a6->ipv6_addr; | 164 | sb = &a6->ipv6_addr; |
164 | sbs = sizeof (struct in6_addr); | 165 | sbs = sizeof (struct in6_addr); |
165 | port = ntohs (a6->u6_port); | 166 | port = ntohs (a6->u6_port); |
166 | } | 167 | } |
167 | else if (addrlen == sizeof (struct IPv4HttpAddress)) | 168 | else if (addrlen == sizeof (struct IPv4HttpAddress)) |
168 | { | 169 | { |
169 | struct IPv4HttpAddress * a4 = (struct IPv4HttpAddress *) addr; | 170 | struct IPv4HttpAddress *a4 = (struct IPv4HttpAddress *) addr; |
171 | |||
170 | sb = &a4->ipv4_addr; | 172 | sb = &a4->ipv4_addr; |
171 | sbs = sizeof (struct in_addr); | 173 | sbs = sizeof (struct in_addr); |
172 | port = ntohs (a4->u4_port); | 174 | port = ntohs (a4->u4_port); |
@@ -218,9 +220,12 @@ http_plugin_address_suggested (void *cls, const void *addr, size_t addrlen) | |||
218 | if (addrlen == sizeof (struct IPv4HttpAddress)) | 220 | if (addrlen == sizeof (struct IPv4HttpAddress)) |
219 | { | 221 | { |
220 | struct IPv4HttpAddress *a4 = (struct IPv4HttpAddress *) addr; | 222 | struct IPv4HttpAddress *a4 = (struct IPv4HttpAddress *) addr; |
223 | |||
221 | while (w_tv4 != NULL) | 224 | while (w_tv4 != NULL) |
222 | { | 225 | { |
223 | if ((0 == memcmp (&w_tv4->addr.ipv4_addr, &a4->ipv4_addr, sizeof (struct in_addr))) && | 226 | if ((0 == |
227 | memcmp (&w_tv4->addr.ipv4_addr, &a4->ipv4_addr, | ||
228 | sizeof (struct in_addr))) && | ||
224 | (w_tv4->addr.u4_port == a4->u4_port)) | 229 | (w_tv4->addr.u4_port == a4->u4_port)) |
225 | break; | 230 | break; |
226 | w_tv4 = w_tv4->next; | 231 | w_tv4 = w_tv4->next; |
@@ -233,9 +238,12 @@ http_plugin_address_suggested (void *cls, const void *addr, size_t addrlen) | |||
233 | if (addrlen == sizeof (struct sockaddr_in6)) | 238 | if (addrlen == sizeof (struct sockaddr_in6)) |
234 | { | 239 | { |
235 | struct IPv6HttpAddress *a6 = (struct IPv6HttpAddress *) addr; | 240 | struct IPv6HttpAddress *a6 = (struct IPv6HttpAddress *) addr; |
241 | |||
236 | while (w_tv6 != NULL) | 242 | while (w_tv6 != NULL) |
237 | { | 243 | { |
238 | if ((0 == memcmp (&w_tv6->addr6.ipv6_addr, &a6->ipv6_addr, sizeof (struct in6_addr))) && | 244 | if ((0 == |
245 | memcmp (&w_tv6->addr6.ipv6_addr, &a6->ipv6_addr, | ||
246 | sizeof (struct in6_addr))) && | ||
239 | (w_tv6->addr6.u6_port == a6->u6_port)) | 247 | (w_tv6->addr6.u6_port == a6->u6_port)) |
240 | break; | 248 | break; |
241 | w_tv6 = w_tv6->next; | 249 | w_tv6 = w_tv6->next; |
@@ -249,11 +257,10 @@ http_plugin_address_suggested (void *cls, const void *addr, size_t addrlen) | |||
249 | } | 257 | } |
250 | 258 | ||
251 | struct GNUNET_TIME_Relative | 259 | struct GNUNET_TIME_Relative |
252 | http_plugin_receive (void *cls, const struct GNUNET_PeerIdentity * peer, | 260 | http_plugin_receive (void *cls, const struct GNUNET_PeerIdentity *peer, |
253 | const struct GNUNET_MessageHeader * message, | 261 | const struct GNUNET_MessageHeader *message, |
254 | struct Session * session, | 262 | struct Session *session, const char *sender_address, |
255 | const char *sender_address, | 263 | uint16_t sender_address_len) |
256 | uint16_t sender_address_len) | ||
257 | { | 264 | { |
258 | struct Session *s = cls; | 265 | struct Session *s = cls; |
259 | struct Plugin *plugin = s->plugin; | 266 | struct Plugin *plugin = s->plugin; |
@@ -263,7 +270,10 @@ http_plugin_receive (void *cls, const struct GNUNET_PeerIdentity * peer, | |||
263 | distance.type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE); | 270 | distance.type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE); |
264 | distance.value = htonl (1); | 271 | distance.value = htonl (1); |
265 | 272 | ||
266 | delay = plugin->env->receive (plugin->env->cls, &s->target, message, (const struct GNUNET_ATS_Information*) &distance, 1, s, s->addr, s->addrlen); | 273 | delay = |
274 | plugin->env->receive (plugin->env->cls, &s->target, message, | ||
275 | (const struct GNUNET_ATS_Information *) &distance, | ||
276 | 1, s, s->addr, s->addrlen); | ||
267 | return delay; | 277 | return delay; |
268 | } | 278 | } |
269 | 279 | ||
@@ -293,14 +303,18 @@ http_plugin_address_to_string (void *cls, const void *addr, size_t addrlen) | |||
293 | { | 303 | { |
294 | a6 = (struct IPv6HttpAddress *) addr; | 304 | a6 = (struct IPv6HttpAddress *) addr; |
295 | address = GNUNET_malloc (INET6_ADDRSTRLEN); | 305 | address = GNUNET_malloc (INET6_ADDRSTRLEN); |
296 | GNUNET_assert(NULL != inet_ntop (AF_INET6, &a6->ipv6_addr, address, INET6_ADDRSTRLEN)); | 306 | GNUNET_assert (NULL != |
307 | inet_ntop (AF_INET6, &a6->ipv6_addr, address, | ||
308 | INET6_ADDRSTRLEN)); | ||
297 | port = ntohs (a6->u6_port); | 309 | port = ntohs (a6->u6_port); |
298 | } | 310 | } |
299 | else if (addrlen == sizeof (struct IPv4HttpAddress)) | 311 | else if (addrlen == sizeof (struct IPv4HttpAddress)) |
300 | { | 312 | { |
301 | a4 = (struct IPv4HttpAddress *) addr; | 313 | a4 = (struct IPv4HttpAddress *) addr; |
302 | address = GNUNET_malloc (INET_ADDRSTRLEN); | 314 | address = GNUNET_malloc (INET_ADDRSTRLEN); |
303 | GNUNET_assert(NULL != inet_ntop (AF_INET, &(a4->ipv4_addr), address, INET_ADDRSTRLEN)); | 315 | GNUNET_assert (NULL != |
316 | inet_ntop (AF_INET, &(a4->ipv4_addr), address, | ||
317 | INET_ADDRSTRLEN)); | ||
304 | port = ntohs (a4->u4_port); | 318 | port = ntohs (a4->u4_port); |
305 | } | 319 | } |
306 | else | 320 | else |
@@ -309,17 +323,21 @@ http_plugin_address_to_string (void *cls, const void *addr, size_t addrlen) | |||
309 | GNUNET_break (0); | 323 | GNUNET_break (0); |
310 | return NULL; | 324 | return NULL; |
311 | } | 325 | } |
312 | #if !BUILD_HTTPS | 326 | #if !BUILD_HTTPS |
313 | char * protocol = "http"; | 327 | char *protocol = "http"; |
314 | #else | 328 | #else |
315 | char * protocol = "https"; | 329 | char *protocol = "https"; |
316 | #endif | 330 | #endif |
317 | 331 | ||
318 | GNUNET_assert (strlen (address) + 7 < (INET6_ADDRSTRLEN + 13)); | 332 | GNUNET_assert (strlen (address) + 7 < (INET6_ADDRSTRLEN + 13)); |
319 | if (addrlen == sizeof (struct IPv6HttpAddress)) | 333 | if (addrlen == sizeof (struct IPv6HttpAddress)) |
320 | res = GNUNET_snprintf (rbuf, sizeof (rbuf), "%s://[%s]:%u/", protocol, address, port); | 334 | res = |
335 | GNUNET_snprintf (rbuf, sizeof (rbuf), "%s://[%s]:%u/", protocol, | ||
336 | address, port); | ||
321 | else if (addrlen == sizeof (struct IPv4HttpAddress)) | 337 | else if (addrlen == sizeof (struct IPv4HttpAddress)) |
322 | res = GNUNET_snprintf (rbuf, sizeof (rbuf), "%s://%s:%u/", protocol, address, port); | 338 | res = |
339 | GNUNET_snprintf (rbuf, sizeof (rbuf), "%s://%s:%u/", protocol, address, | ||
340 | port); | ||
323 | 341 | ||
324 | GNUNET_free (address); | 342 | GNUNET_free (address); |
325 | GNUNET_assert (res != 0); | 343 | GNUNET_assert (res != 0); |
@@ -328,8 +346,8 @@ http_plugin_address_to_string (void *cls, const void *addr, size_t addrlen) | |||
328 | 346 | ||
329 | struct Session * | 347 | struct Session * |
330 | lookup_session (struct Plugin *plugin, const struct GNUNET_PeerIdentity *target, | 348 | lookup_session (struct Plugin *plugin, const struct GNUNET_PeerIdentity *target, |
331 | struct Session * session, | 349 | struct Session *session, const void *addr, size_t addrlen, |
332 | const void *addr, size_t addrlen, int force_address) | 350 | int force_address) |
333 | { | 351 | { |
334 | struct Session *s = NULL; | 352 | struct Session *s = NULL; |
335 | struct Session *t = NULL; | 353 | struct Session *t = NULL; |
@@ -343,9 +361,15 @@ lookup_session (struct Plugin *plugin, const struct GNUNET_PeerIdentity *target, | |||
343 | { | 361 | { |
344 | #if 0 | 362 | #if 0 |
345 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name, | 363 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name, |
346 | "Comparing peer `%s' address `%s' len %i session %X to \n", GNUNET_i2s(target), GNUNET_a2s(addr,addrlen), addrlen, session); | 364 | "Comparing peer `%s' address `%s' len %i session %X to \n", |
347 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name,"peer `%s' address `%s' len %i session %X \n\n", GNUNET_i2s(&t->target), GNUNET_a2s(t->addr,t->addrlen), t->addrlen, t); | 365 | GNUNET_i2s (target), GNUNET_a2s (addr, addrlen), addrlen, |
348 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name,"memcmp %i \n", memcmp (addr, t->addr, addrlen)); | 366 | session); |
367 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name, | ||
368 | "peer `%s' address `%s' len %i session %X \n\n", | ||
369 | GNUNET_i2s (&t->target), GNUNET_a2s (t->addr, t->addrlen), | ||
370 | t->addrlen, t); | ||
371 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name, "memcmp %i \n", | ||
372 | memcmp (addr, t->addr, addrlen)); | ||
349 | #endif | 373 | #endif |
350 | e_peer = GNUNET_NO; | 374 | e_peer = GNUNET_NO; |
351 | e_addr = GNUNET_NO; | 375 | e_addr = GNUNET_NO; |
@@ -362,13 +386,13 @@ lookup_session (struct Plugin *plugin, const struct GNUNET_PeerIdentity *target, | |||
362 | } | 386 | } |
363 | if ((t == session)) | 387 | if ((t == session)) |
364 | { | 388 | { |
365 | if(t->addrlen == session->addrlen) | 389 | if (t->addrlen == session->addrlen) |
366 | { | ||
367 | if (0 == memcmp (session->addr, t->addr, t->addrlen)) | ||
368 | { | 390 | { |
369 | e_addr = GNUNET_YES; | 391 | if (0 == memcmp (session->addr, t->addr, t->addrlen)) |
392 | { | ||
393 | e_addr = GNUNET_YES; | ||
394 | } | ||
370 | } | 395 | } |
371 | } | ||
372 | } | 396 | } |
373 | } | 397 | } |
374 | 398 | ||
@@ -377,7 +401,8 @@ lookup_session (struct Plugin *plugin, const struct GNUNET_PeerIdentity *target, | |||
377 | s = t; | 401 | s = t; |
378 | break; | 402 | break; |
379 | } | 403 | } |
380 | if ((e_peer == GNUNET_YES) && (force_address == GNUNET_YES) && (e_addr == GNUNET_YES)) | 404 | if ((e_peer == GNUNET_YES) && (force_address == GNUNET_YES) && |
405 | (e_addr == GNUNET_YES)) | ||
381 | { | 406 | { |
382 | s = t; | 407 | s = t; |
383 | break; | 408 | break; |
@@ -405,8 +430,8 @@ delete_session (struct Session *s) | |||
405 | s->msg_tk = NULL; | 430 | s->msg_tk = NULL; |
406 | } | 431 | } |
407 | GNUNET_free (s->addr); | 432 | GNUNET_free (s->addr); |
408 | GNUNET_free_non_null(s->server_recv); | 433 | GNUNET_free_non_null (s->server_recv); |
409 | GNUNET_free_non_null(s->server_send); | 434 | GNUNET_free_non_null (s->server_send); |
410 | GNUNET_free (s); | 435 | GNUNET_free (s); |
411 | } | 436 | } |
412 | 437 | ||
@@ -416,7 +441,9 @@ create_session (struct Plugin *plugin, const struct GNUNET_PeerIdentity *target, | |||
416 | GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls) | 441 | GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls) |
417 | { | 442 | { |
418 | struct Session *s = NULL; | 443 | struct Session *s = NULL; |
419 | GNUNET_assert ((addrlen == sizeof (struct IPv6HttpAddress)) || (addrlen == sizeof (struct IPv4HttpAddress))); | 444 | |
445 | GNUNET_assert ((addrlen == sizeof (struct IPv6HttpAddress)) || | ||
446 | (addrlen == sizeof (struct IPv4HttpAddress))); | ||
420 | s = GNUNET_malloc (sizeof (struct Session)); | 447 | s = GNUNET_malloc (sizeof (struct Session)); |
421 | memcpy (&s->target, target, sizeof (struct GNUNET_PeerIdentity)); | 448 | memcpy (&s->target, target, sizeof (struct GNUNET_PeerIdentity)); |
422 | s->plugin = plugin; | 449 | s->plugin = plugin; |
@@ -424,14 +451,13 @@ create_session (struct Plugin *plugin, const struct GNUNET_PeerIdentity *target, | |||
424 | memcpy (s->addr, addr, addrlen); | 451 | memcpy (s->addr, addr, addrlen); |
425 | s->addrlen = addrlen; | 452 | s->addrlen = addrlen; |
426 | s->next = NULL; | 453 | s->next = NULL; |
427 | s->next_receive = GNUNET_TIME_absolute_get_zero(); | 454 | s->next_receive = GNUNET_TIME_absolute_get_zero (); |
428 | return s; | 455 | return s; |
429 | } | 456 | } |
430 | 457 | ||
431 | void | 458 | void |
432 | notify_session_end (void *cls, | 459 | notify_session_end (void *cls, const struct GNUNET_PeerIdentity *peer, |
433 | const struct GNUNET_PeerIdentity * | 460 | struct Session *s) |
434 | peer, struct Session * s) | ||
435 | { | 461 | { |
436 | struct Plugin *plugin = cls; | 462 | struct Plugin *plugin = cls; |
437 | 463 | ||
@@ -486,28 +512,38 @@ http_plugin_send (void *cls, const struct GNUNET_PeerIdentity *target, | |||
486 | { | 512 | { |
487 | struct Plugin *plugin = cls; | 513 | struct Plugin *plugin = cls; |
488 | struct HTTP_Message *msg; | 514 | struct HTTP_Message *msg; |
515 | |||
489 | GNUNET_assert (plugin != NULL); | 516 | GNUNET_assert (plugin != NULL); |
490 | 517 | ||
491 | int res = GNUNET_SYSERR; | 518 | int res = GNUNET_SYSERR; |
492 | 519 | ||
493 | #if DEBUG_HTTP | 520 | #if DEBUG_HTTP |
494 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 521 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, |
495 | "Sending %u bytes to peer `%s' on address `%s' %X %i\n", msgbuf_size, | 522 | "Sending %u bytes to peer `%s' on address `%s' %X %i\n", |
496 | GNUNET_i2s (target), ((addr != NULL) && (addrlen != 0)) ? http_plugin_address_to_string(plugin, addr, addrlen) : "<inbound>", session, force_address); | 523 | msgbuf_size, GNUNET_i2s (target), ((addr != NULL) && |
524 | (addrlen != | ||
525 | 0)) ? | ||
526 | http_plugin_address_to_string (plugin, addr, | ||
527 | addrlen) : "<inbound>", | ||
528 | session, force_address); | ||
497 | #endif | 529 | #endif |
498 | 530 | ||
499 | struct Session *s = NULL; | 531 | struct Session *s = NULL; |
500 | 532 | ||
501 | 533 | ||
502 | if (addrlen != 0) | 534 | if (addrlen != 0) |
503 | GNUNET_assert ((addrlen == sizeof (struct IPv4HttpAddress)) || | 535 | GNUNET_assert ((addrlen == sizeof (struct IPv4HttpAddress)) || |
504 | (addrlen == sizeof (struct IPv6HttpAddress))); | 536 | (addrlen == sizeof (struct IPv6HttpAddress))); |
505 | 537 | ||
506 | /* look for existing connection */ | 538 | /* look for existing connection */ |
507 | s = lookup_session (plugin, target, session, addr, addrlen, 1); | 539 | s = lookup_session (plugin, target, session, addr, addrlen, 1); |
508 | #if DEBUG_HTTP | 540 | #if DEBUG_HTTP |
509 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 541 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, |
510 | "%s existing session: %s\n", (s!=NULL) ? "Found" : "NOT Found", ((s != NULL) && (s->inbound == GNUNET_YES)) ? "inbound" : "outbound"); | 542 | "%s existing session: %s\n", |
543 | (s != NULL) ? "Found" : "NOT Found", ((s != NULL) && | ||
544 | (s->inbound == | ||
545 | GNUNET_YES)) ? | ||
546 | "inbound" : "outbound"); | ||
511 | #endif | 547 | #endif |
512 | 548 | ||
513 | /* create new outbound connection */ | 549 | /* create new outbound connection */ |
@@ -517,8 +553,7 @@ http_plugin_send (void *cls, const struct GNUNET_PeerIdentity *target, | |||
517 | { | 553 | { |
518 | GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, plugin->name, | 554 | GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, plugin->name, |
519 | "Maximum number of connections reached, " | 555 | "Maximum number of connections reached, " |
520 | "cannot connect to peer `%s'\n", | 556 | "cannot connect to peer `%s'\n", GNUNET_i2s (target)); |
521 | GNUNET_i2s (target)); | ||
522 | return res; | 557 | return res; |
523 | } | 558 | } |
524 | 559 | ||
@@ -554,8 +589,8 @@ http_plugin_send (void *cls, const struct GNUNET_PeerIdentity *target, | |||
554 | "Using outbound client session to send to `%s'\n", | 589 | "Using outbound client session to send to `%s'\n", |
555 | GNUNET_i2s (target)); | 590 | GNUNET_i2s (target)); |
556 | #endif | 591 | #endif |
557 | client_send (s, msg); | 592 | client_send (s, msg); |
558 | res = msgbuf_size; | 593 | res = msgbuf_size; |
559 | } | 594 | } |
560 | if (s->inbound == GNUNET_YES) | 595 | if (s->inbound == GNUNET_YES) |
561 | { | 596 | { |
@@ -621,14 +656,16 @@ nat_add_address (void *cls, int add_remove, const struct sockaddr *addr, | |||
621 | case AF_INET: | 656 | case AF_INET: |
622 | w_t4 = plugin->ipv4_addr_head; | 657 | w_t4 = plugin->ipv4_addr_head; |
623 | struct sockaddr_in *a4 = (struct sockaddr_in *) addr; | 658 | struct sockaddr_in *a4 = (struct sockaddr_in *) addr; |
659 | |||
624 | while (w_t4 != NULL) | 660 | while (w_t4 != NULL) |
625 | { | 661 | { |
626 | int res = memcmp (&w_t4->addr.ipv4_addr, | 662 | int res = memcmp (&w_t4->addr.ipv4_addr, |
627 | &a4->sin_addr, | 663 | &a4->sin_addr, |
628 | sizeof (struct in_addr)); | 664 | sizeof (struct in_addr)); |
665 | |||
629 | if (res == 0) | 666 | if (res == 0) |
630 | { | 667 | { |
631 | if (a4->sin_port!= w_t4->addr.u4_port) | 668 | if (a4->sin_port != w_t4->addr.u4_port) |
632 | res = -1; | 669 | res = -1; |
633 | } | 670 | } |
634 | 671 | ||
@@ -639,8 +676,7 @@ nat_add_address (void *cls, int add_remove, const struct sockaddr *addr, | |||
639 | if (w_t4 == NULL) | 676 | if (w_t4 == NULL) |
640 | { | 677 | { |
641 | w_t4 = GNUNET_malloc (sizeof (struct IPv4HttpAddressWrapper)); | 678 | w_t4 = GNUNET_malloc (sizeof (struct IPv4HttpAddressWrapper)); |
642 | memcpy (&w_t4->addr.ipv4_addr, &a4->sin_addr, | 679 | memcpy (&w_t4->addr.ipv4_addr, &a4->sin_addr, sizeof (struct in_addr)); |
643 | sizeof (struct in_addr)); | ||
644 | w_t4->addr.u4_port = a4->sin_port; | 680 | w_t4->addr.u4_port = a4->sin_port; |
645 | 681 | ||
646 | GNUNET_CONTAINER_DLL_insert (plugin->ipv4_addr_head, | 682 | GNUNET_CONTAINER_DLL_insert (plugin->ipv4_addr_head, |
@@ -649,18 +685,23 @@ nat_add_address (void *cls, int add_remove, const struct sockaddr *addr, | |||
649 | #if DEBUG_HTTP | 685 | #if DEBUG_HTTP |
650 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 686 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, |
651 | "Notifying transport to add IPv4 address `%s'\n", | 687 | "Notifying transport to add IPv4 address `%s'\n", |
652 | http_plugin_address_to_string(NULL, &w_t4->addr, sizeof (struct IPv4HttpAddress))); | 688 | http_plugin_address_to_string (NULL, &w_t4->addr, |
689 | sizeof (struct | ||
690 | IPv4HttpAddress))); | ||
653 | #endif | 691 | #endif |
654 | plugin->env->notify_address (plugin->env->cls, add_remove, &w_t4->addr, sizeof (struct IPv4HttpAddress)); | 692 | plugin->env->notify_address (plugin->env->cls, add_remove, &w_t4->addr, |
693 | sizeof (struct IPv4HttpAddress)); | ||
655 | 694 | ||
656 | break; | 695 | break; |
657 | case AF_INET6: | 696 | case AF_INET6: |
658 | w_t6 = plugin->ipv6_addr_head; | 697 | w_t6 = plugin->ipv6_addr_head; |
659 | struct sockaddr_in6 *a6 = (struct sockaddr_in6 *) addr; | 698 | struct sockaddr_in6 *a6 = (struct sockaddr_in6 *) addr; |
699 | |||
660 | while (w_t6) | 700 | while (w_t6) |
661 | { | 701 | { |
662 | int res = memcmp (&w_t6->addr6.ipv6_addr, &a6->sin6_addr, | 702 | int res = memcmp (&w_t6->addr6.ipv6_addr, &a6->sin6_addr, |
663 | sizeof (struct in6_addr)); | 703 | sizeof (struct in6_addr)); |
704 | |||
664 | if (res == 0) | 705 | if (res == 0) |
665 | { | 706 | { |
666 | if (a6->sin6_port != w_t6->addr6.u6_port) | 707 | if (a6->sin6_port != w_t6->addr6.u6_port) |
@@ -674,8 +715,7 @@ nat_add_address (void *cls, int add_remove, const struct sockaddr *addr, | |||
674 | { | 715 | { |
675 | w_t6 = GNUNET_malloc (sizeof (struct IPv6HttpAddressWrapper)); | 716 | w_t6 = GNUNET_malloc (sizeof (struct IPv6HttpAddressWrapper)); |
676 | 717 | ||
677 | memcpy (&w_t6->addr6.ipv6_addr, &a6->sin6_addr, | 718 | memcpy (&w_t6->addr6.ipv6_addr, &a6->sin6_addr, sizeof (struct in6_addr)); |
678 | sizeof (struct in6_addr)); | ||
679 | w_t6->addr6.u6_port = a6->sin6_port; | 719 | w_t6->addr6.u6_port = a6->sin6_port; |
680 | 720 | ||
681 | GNUNET_CONTAINER_DLL_insert (plugin->ipv6_addr_head, | 721 | GNUNET_CONTAINER_DLL_insert (plugin->ipv6_addr_head, |
@@ -684,9 +724,12 @@ nat_add_address (void *cls, int add_remove, const struct sockaddr *addr, | |||
684 | #if DEBUG_HTTP | 724 | #if DEBUG_HTTP |
685 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 725 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, |
686 | "Notifying transport to add IPv6 address `%s'\n", | 726 | "Notifying transport to add IPv6 address `%s'\n", |
687 | http_plugin_address_to_string(NULL, &w_t6->addr6, sizeof (struct IPv6HttpAddress))); | 727 | http_plugin_address_to_string (NULL, &w_t6->addr6, |
728 | sizeof (struct | ||
729 | IPv6HttpAddress))); | ||
688 | #endif | 730 | #endif |
689 | plugin->env->notify_address (plugin->env->cls, add_remove, &w_t6->addr6, sizeof (struct IPv6HttpAddress)); | 731 | plugin->env->notify_address (plugin->env->cls, add_remove, &w_t6->addr6, |
732 | sizeof (struct IPv6HttpAddress)); | ||
690 | break; | 733 | break; |
691 | default: | 734 | default: |
692 | return; | 735 | return; |
@@ -709,14 +752,16 @@ nat_remove_address (void *cls, int add_remove, const struct sockaddr *addr, | |||
709 | case AF_INET: | 752 | case AF_INET: |
710 | w_t4 = plugin->ipv4_addr_head; | 753 | w_t4 = plugin->ipv4_addr_head; |
711 | struct sockaddr_in *a4 = (struct sockaddr_in *) addr; | 754 | struct sockaddr_in *a4 = (struct sockaddr_in *) addr; |
755 | |||
712 | while (w_t4 != NULL) | 756 | while (w_t4 != NULL) |
713 | { | 757 | { |
714 | int res = memcmp (&w_t4->addr.ipv4_addr, | 758 | int res = memcmp (&w_t4->addr.ipv4_addr, |
715 | &a4->sin_addr, | 759 | &a4->sin_addr, |
716 | sizeof (struct in_addr)); | 760 | sizeof (struct in_addr)); |
761 | |||
717 | if (res == 0) | 762 | if (res == 0) |
718 | { | 763 | { |
719 | if (a4->sin_port!= w_t4->addr.u4_port) | 764 | if (a4->sin_port != w_t4->addr.u4_port) |
720 | res = -1; | 765 | res = -1; |
721 | } | 766 | } |
722 | 767 | ||
@@ -730,7 +775,9 @@ nat_remove_address (void *cls, int add_remove, const struct sockaddr *addr, | |||
730 | #if DEBUG_HTTP | 775 | #if DEBUG_HTTP |
731 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 776 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, |
732 | "Notifying transport to remove IPv4 address `%s'\n", | 777 | "Notifying transport to remove IPv4 address `%s'\n", |
733 | http_plugin_address_to_string(NULL, &w_t4->addr, sizeof (struct IPv4HttpAddress))); | 778 | http_plugin_address_to_string (NULL, &w_t4->addr, |
779 | sizeof (struct | ||
780 | IPv4HttpAddress))); | ||
734 | #endif | 781 | #endif |
735 | plugin->env->notify_address (plugin->env->cls, add_remove, &w_t4->addr, | 782 | plugin->env->notify_address (plugin->env->cls, add_remove, &w_t4->addr, |
736 | sizeof (struct IPv4HttpAddress)); | 783 | sizeof (struct IPv4HttpAddress)); |
@@ -742,10 +789,12 @@ nat_remove_address (void *cls, int add_remove, const struct sockaddr *addr, | |||
742 | case AF_INET6: | 789 | case AF_INET6: |
743 | w_t6 = plugin->ipv6_addr_head; | 790 | w_t6 = plugin->ipv6_addr_head; |
744 | struct sockaddr_in6 *a6 = (struct sockaddr_in6 *) addr; | 791 | struct sockaddr_in6 *a6 = (struct sockaddr_in6 *) addr; |
792 | |||
745 | while (w_t6) | 793 | while (w_t6) |
746 | { | 794 | { |
747 | int res = memcmp (&w_t6->addr6.ipv6_addr, &a6->sin6_addr, | 795 | int res = memcmp (&w_t6->addr6.ipv6_addr, &a6->sin6_addr, |
748 | sizeof (struct in6_addr)); | 796 | sizeof (struct in6_addr)); |
797 | |||
749 | if (res == 0) | 798 | if (res == 0) |
750 | { | 799 | { |
751 | if (a6->sin6_port != w_t6->addr6.u6_port) | 800 | if (a6->sin6_port != w_t6->addr6.u6_port) |
@@ -760,7 +809,9 @@ nat_remove_address (void *cls, int add_remove, const struct sockaddr *addr, | |||
760 | #if DEBUG_HTTP | 809 | #if DEBUG_HTTP |
761 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 810 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, |
762 | "Notifying transport to remove IPv6 address `%s'\n", | 811 | "Notifying transport to remove IPv6 address `%s'\n", |
763 | http_plugin_address_to_string(NULL, &w_t6->addr6, sizeof (struct IPv6HttpAddress))); | 812 | http_plugin_address_to_string (NULL, &w_t6->addr6, |
813 | sizeof (struct | ||
814 | IPv6HttpAddress))); | ||
764 | #endif | 815 | #endif |
765 | plugin->env->notify_address (plugin->env->cls, add_remove, &w_t6->addr6, | 816 | plugin->env->notify_address (plugin->env->cls, add_remove, &w_t6->addr6, |
766 | sizeof (struct IPv6HttpAddress)); | 817 | sizeof (struct IPv6HttpAddress)); |
@@ -801,7 +852,7 @@ nat_port_map_callback (void *cls, int add_remove, const struct sockaddr *addr, | |||
801 | switch (add_remove) | 852 | switch (add_remove) |
802 | { | 853 | { |
803 | case GNUNET_YES: | 854 | case GNUNET_YES: |
804 | nat_add_address (cls, add_remove, addr, addrlen); | 855 | nat_add_address (cls, add_remove, addr, addrlen); |
805 | break; | 856 | break; |
806 | case GNUNET_NO: | 857 | case GNUNET_NO: |
807 | nat_remove_address (cls, add_remove, addr, addrlen); | 858 | nat_remove_address (cls, add_remove, addr, addrlen); |
@@ -813,6 +864,7 @@ void | |||
813 | http_check_ipv6 (struct Plugin *plugin) | 864 | http_check_ipv6 (struct Plugin *plugin) |
814 | { | 865 | { |
815 | struct GNUNET_NETWORK_Handle *desc = NULL; | 866 | struct GNUNET_NETWORK_Handle *desc = NULL; |
867 | |||
816 | if (plugin->ipv6 == GNUNET_YES) | 868 | if (plugin->ipv6 == GNUNET_YES) |
817 | { | 869 | { |
818 | /* probe IPv6 support */ | 870 | /* probe IPv6 support */ |
@@ -825,8 +877,8 @@ http_check_ipv6 (struct Plugin *plugin) | |||
825 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "socket"); | 877 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "socket"); |
826 | } | 878 | } |
827 | GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, plugin->name, | 879 | GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, plugin->name, |
828 | _ | 880 | _ |
829 | ("Disabling IPv6 since it is not supported on this system!\n")); | 881 | ("Disabling IPv6 since it is not supported on this system!\n")); |
830 | plugin->ipv6 = GNUNET_NO; | 882 | plugin->ipv6 = GNUNET_NO; |
831 | } | 883 | } |
832 | else | 884 | else |
@@ -835,17 +887,16 @@ http_check_ipv6 (struct Plugin *plugin) | |||
835 | desc = NULL; | 887 | desc = NULL; |
836 | } | 888 | } |
837 | 889 | ||
838 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 890 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, |
839 | "Testing IPv6 on this system: %s\n", (plugin->ipv6 == GNUNET_YES) ? "successful" : "failed"); | 891 | "Testing IPv6 on this system: %s\n", |
892 | (plugin->ipv6 == GNUNET_YES) ? "successful" : "failed"); | ||
840 | } | 893 | } |
841 | } | 894 | } |
842 | 895 | ||
843 | int | 896 | int |
844 | http_get_addresses (struct Plugin *plugin, | 897 | http_get_addresses (struct Plugin *plugin, const char *serviceName, |
845 | const char *serviceName, | 898 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
846 | const struct GNUNET_CONFIGURATION_Handle | 899 | struct sockaddr ***addrs, socklen_t ** addr_lens) |
847 | *cfg, struct sockaddr ***addrs, | ||
848 | socklen_t ** addr_lens) | ||
849 | { | 900 | { |
850 | int disablev6; | 901 | int disablev6; |
851 | unsigned long long port; | 902 | unsigned long long port; |
@@ -892,8 +943,8 @@ http_get_addresses (struct Plugin *plugin, | |||
892 | if (hostname != NULL) | 943 | if (hostname != NULL) |
893 | { | 944 | { |
894 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 945 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, |
895 | "Resolving `%s' since that is where `%s' will bind to.\n", | 946 | "Resolving `%s' since that is where `%s' will bind to.\n", |
896 | hostname, serviceName); | 947 | hostname, serviceName); |
897 | memset (&hints, 0, sizeof (struct addrinfo)); | 948 | memset (&hints, 0, sizeof (struct addrinfo)); |
898 | if (disablev6) | 949 | if (disablev6) |
899 | hints.ai_family = AF_INET; | 950 | hints.ai_family = AF_INET; |
@@ -938,8 +989,8 @@ http_get_addresses (struct Plugin *plugin, | |||
938 | if ((pos->ai_socktype != SOCK_STREAM) && (pos->ai_socktype != 0)) | 989 | if ((pos->ai_socktype != SOCK_STREAM) && (pos->ai_socktype != 0)) |
939 | continue; /* huh? */ | 990 | continue; /* huh? */ |
940 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 991 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, |
941 | "Service will bind to `%s'\n", | 992 | "Service will bind to `%s'\n", GNUNET_a2s (pos->ai_addr, |
942 | GNUNET_a2s (pos->ai_addr, pos->ai_addrlen)); | 993 | pos->ai_addrlen)); |
943 | if (pos->ai_family == AF_INET) | 994 | if (pos->ai_family == AF_INET) |
944 | { | 995 | { |
945 | GNUNET_assert (pos->ai_addrlen == sizeof (struct sockaddr_in)); | 996 | GNUNET_assert (pos->ai_addrlen == sizeof (struct sockaddr_in)); |
@@ -1019,10 +1070,10 @@ start_report_addresses (struct Plugin *plugin) | |||
1019 | socklen_t *addrlens; | 1070 | socklen_t *addrlens; |
1020 | 1071 | ||
1021 | res = | 1072 | res = |
1022 | http_get_addresses (plugin, plugin->name, plugin->env->cfg, | 1073 | http_get_addresses (plugin, plugin->name, plugin->env->cfg, &addrs, |
1023 | &addrs, &addrlens); | 1074 | &addrlens); |
1024 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1075 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, |
1025 | _("Found %u addresses to report to NAT service\n"),res); | 1076 | _("Found %u addresses to report to NAT service\n"), res); |
1026 | 1077 | ||
1027 | if (res != GNUNET_SYSERR) | 1078 | if (res != GNUNET_SYSERR) |
1028 | { | 1079 | { |
@@ -1030,14 +1081,12 @@ start_report_addresses (struct Plugin *plugin) | |||
1030 | GNUNET_NAT_register (plugin->env->cfg, GNUNET_YES, plugin->port, | 1081 | GNUNET_NAT_register (plugin->env->cfg, GNUNET_YES, plugin->port, |
1031 | (unsigned int) res, | 1082 | (unsigned int) res, |
1032 | (const struct sockaddr **) addrs, addrlens, | 1083 | (const struct sockaddr **) addrs, addrlens, |
1033 | &nat_port_map_callback, NULL, | 1084 | &nat_port_map_callback, NULL, plugin); |
1034 | plugin); | ||
1035 | while (res > 0) | 1085 | while (res > 0) |
1036 | { | 1086 | { |
1037 | res--; | 1087 | res--; |
1038 | #if 0 | 1088 | #if 0 |
1039 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name, | 1089 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name, _("FREEING %s\n"), |
1040 | _("FREEING %s\n"), | ||
1041 | GNUNET_a2s (addrs[res], addrlens[res])); | 1090 | GNUNET_a2s (addrs[res], addrlens[res])); |
1042 | #endif | 1091 | #endif |
1043 | GNUNET_assert (addrs[res] != NULL); | 1092 | GNUNET_assert (addrs[res] != NULL); |
@@ -1136,24 +1185,28 @@ configure_plugin (struct Plugin *plugin) | |||
1136 | if (plugin->port == 0) | 1185 | if (plugin->port == 0) |
1137 | { | 1186 | { |
1138 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1187 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, |
1139 | _("Port 0, client only mode\n")); | 1188 | _("Port 0, client only mode\n")); |
1140 | plugin->client_only = GNUNET_YES; | 1189 | plugin->client_only = GNUNET_YES; |
1141 | } | 1190 | } |
1142 | 1191 | ||
1143 | char * bind4_address = NULL; | 1192 | char *bind4_address = NULL; |
1144 | if ((plugin->ipv4 == GNUNET_YES) && (GNUNET_YES == | 1193 | |
1145 | GNUNET_CONFIGURATION_get_value_string (plugin->env->cfg, plugin->name, | 1194 | if ((plugin->ipv4 == GNUNET_YES) && |
1146 | "BINDTO", &bind4_address))) | 1195 | (GNUNET_YES == |
1196 | GNUNET_CONFIGURATION_get_value_string (plugin->env->cfg, plugin->name, | ||
1197 | "BINDTO", &bind4_address))) | ||
1147 | { | 1198 | { |
1148 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1199 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, |
1149 | "Binding %s plugin to specific IPv4 address: `%s'\n", | 1200 | "Binding %s plugin to specific IPv4 address: `%s'\n", |
1150 | plugin->protocol, bind4_address); | 1201 | plugin->protocol, bind4_address); |
1151 | plugin->server_addr_v4 = GNUNET_malloc (sizeof (struct sockaddr_in)); | 1202 | plugin->server_addr_v4 = GNUNET_malloc (sizeof (struct sockaddr_in)); |
1152 | if (1 != inet_pton (AF_INET, bind4_address, &plugin->server_addr_v4->sin_addr)) | 1203 | if (1 != |
1204 | inet_pton (AF_INET, bind4_address, &plugin->server_addr_v4->sin_addr)) | ||
1153 | { | 1205 | { |
1154 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name, | 1206 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name, |
1155 | _("Specific IPv4 address `%s' for plugin %s in configuration file is invalid! Binding to all addresses!\n"), | 1207 | _ |
1156 | bind4_address, plugin->protocol); | 1208 | ("Specific IPv4 address `%s' for plugin %s in configuration file is invalid! Binding to all addresses!\n"), |
1209 | bind4_address, plugin->protocol); | ||
1157 | GNUNET_free (plugin->server_addr_v4); | 1210 | GNUNET_free (plugin->server_addr_v4); |
1158 | plugin->server_addr_v4 = NULL; | 1211 | plugin->server_addr_v4 = NULL; |
1159 | } | 1212 | } |
@@ -1166,20 +1219,24 @@ configure_plugin (struct Plugin *plugin) | |||
1166 | } | 1219 | } |
1167 | 1220 | ||
1168 | 1221 | ||
1169 | char * bind6_address = NULL; | 1222 | char *bind6_address = NULL; |
1170 | if ((plugin->ipv6 == GNUNET_YES) && (GNUNET_YES == | 1223 | |
1171 | GNUNET_CONFIGURATION_get_value_string (plugin->env->cfg, plugin->name, | 1224 | if ((plugin->ipv6 == GNUNET_YES) && |
1172 | "BINDTO6", &bind6_address))) | 1225 | (GNUNET_YES == |
1226 | GNUNET_CONFIGURATION_get_value_string (plugin->env->cfg, plugin->name, | ||
1227 | "BINDTO6", &bind6_address))) | ||
1173 | { | 1228 | { |
1174 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1229 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, |
1175 | "Binding %s plugin to specific IPv6 address: `%s'\n", | 1230 | "Binding %s plugin to specific IPv6 address: `%s'\n", |
1176 | plugin->protocol, bind6_address); | 1231 | plugin->protocol, bind6_address); |
1177 | plugin->server_addr_v6 = GNUNET_malloc (sizeof (struct sockaddr_in6)); | 1232 | plugin->server_addr_v6 = GNUNET_malloc (sizeof (struct sockaddr_in6)); |
1178 | if (1 != inet_pton (AF_INET6, bind6_address, &plugin->server_addr_v6->sin6_addr)) | 1233 | if (1 != |
1234 | inet_pton (AF_INET6, bind6_address, &plugin->server_addr_v6->sin6_addr)) | ||
1179 | { | 1235 | { |
1180 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name, | 1236 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name, |
1181 | _("Specific IPv6 address `%s' for plugin %s in configuration file is invalid! Binding to all addresses!\n"), | 1237 | _ |
1182 | bind6_address, plugin->protocol); | 1238 | ("Specific IPv6 address `%s' for plugin %s in configuration file is invalid! Binding to all addresses!\n"), |
1239 | bind6_address, plugin->protocol); | ||
1183 | GNUNET_free (plugin->server_addr_v6); | 1240 | GNUNET_free (plugin->server_addr_v6); |
1184 | plugin->server_addr_v6 = NULL; | 1241 | plugin->server_addr_v6 = NULL; |
1185 | } | 1242 | } |
@@ -1194,6 +1251,7 @@ configure_plugin (struct Plugin *plugin) | |||
1194 | 1251 | ||
1195 | /* Optional parameters */ | 1252 | /* Optional parameters */ |
1196 | unsigned long long maxneigh; | 1253 | unsigned long long maxneigh; |
1254 | |||
1197 | if (GNUNET_OK != | 1255 | if (GNUNET_OK != |
1198 | GNUNET_CONFIGURATION_get_value_number (plugin->env->cfg, plugin->name, | 1256 | GNUNET_CONFIGURATION_get_value_number (plugin->env->cfg, plugin->name, |
1199 | "MAX_CONNECTIONS", &maxneigh)) | 1257 | "MAX_CONNECTIONS", &maxneigh)) |
@@ -1303,8 +1361,8 @@ LIBGNUNET_PLUGIN_TRANSPORT_DONE (void *cls) | |||
1303 | while (s != NULL) | 1361 | while (s != NULL) |
1304 | { | 1362 | { |
1305 | #if DEBUG_HTTP | 1363 | #if DEBUG_HTTP |
1306 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1364 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, |
1307 | "Disconnecting `%s' \n", GNUNET_i2s (&s->target)); | 1365 | "Disconnecting `%s' \n", GNUNET_i2s (&s->target)); |
1308 | #endif | 1366 | #endif |
1309 | if (s->inbound == GNUNET_NO) | 1367 | if (s->inbound == GNUNET_NO) |
1310 | GNUNET_assert (GNUNET_OK == client_disconnect (s)); | 1368 | GNUNET_assert (GNUNET_OK == client_disconnect (s)); |
@@ -1314,15 +1372,13 @@ LIBGNUNET_PLUGIN_TRANSPORT_DONE (void *cls) | |||
1314 | } | 1372 | } |
1315 | 1373 | ||
1316 | #if DEBUG_HTTP | 1374 | #if DEBUG_HTTP |
1317 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1375 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, "Stopping server\n"); |
1318 | "Stopping server\n"); | ||
1319 | #endif | 1376 | #endif |
1320 | /* Stop server */ | 1377 | /* Stop server */ |
1321 | server_stop (plugin); | 1378 | server_stop (plugin); |
1322 | 1379 | ||
1323 | #if DEBUG_HTTP | 1380 | #if DEBUG_HTTP |
1324 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1381 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, "Stopping client\n"); |
1325 | "Stopping client\n"); | ||
1326 | #endif | 1382 | #endif |
1327 | /* Stop client */ | 1383 | /* Stop client */ |
1328 | client_stop (plugin); | 1384 | client_stop (plugin); |
@@ -1332,6 +1388,7 @@ LIBGNUNET_PLUGIN_TRANSPORT_DONE (void *cls) | |||
1332 | while (s != NULL) | 1388 | while (s != NULL) |
1333 | { | 1389 | { |
1334 | struct Session *t = s->next; | 1390 | struct Session *t = s->next; |
1391 | |||
1335 | GNUNET_CONTAINER_DLL_remove (plugin->head, plugin->tail, s); | 1392 | GNUNET_CONTAINER_DLL_remove (plugin->head, plugin->tail, s); |
1336 | delete_session (s); | 1393 | delete_session (s); |
1337 | s = t; | 1394 | s = t; |