diff options
Diffstat (limited to 'src/transport/plugin_transport_unix.c')
-rw-r--r-- | src/transport/plugin_transport_unix.c | 35 |
1 files changed, 1 insertions, 34 deletions
diff --git a/src/transport/plugin_transport_unix.c b/src/transport/plugin_transport_unix.c index 64c2683c8..2aa987914 100644 --- a/src/transport/plugin_transport_unix.c +++ b/src/transport/plugin_transport_unix.c | |||
@@ -42,9 +42,6 @@ | |||
42 | #include "gnunet_transport_plugin.h" | 42 | #include "gnunet_transport_plugin.h" |
43 | #include "transport.h" | 43 | #include "transport.h" |
44 | 44 | ||
45 | #define DEBUG_UNIX GNUNET_EXTRALOGGING | ||
46 | #define DETAILS GNUNET_NO | ||
47 | |||
48 | #define MAX_PROBES 20 | 45 | #define MAX_PROBES 20 |
49 | 46 | ||
50 | /* | 47 | /* |
@@ -254,10 +251,7 @@ get_session_delete_it (void *cls, const GNUNET_HashCode * key, void *value) | |||
254 | struct Plugin *plugin = cls; | 251 | struct Plugin *plugin = cls; |
255 | GNUNET_assert (plugin != NULL); | 252 | GNUNET_assert (plugin != NULL); |
256 | 253 | ||
257 | #if DEBUG_UNIX | ||
258 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Deleting session for peer `%s' `%s' \n", GNUNET_i2s (&s->target), s->addr); | 254 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Deleting session for peer `%s' `%s' \n", GNUNET_i2s (&s->target), s->addr); |
259 | #endif | ||
260 | |||
261 | plugin->env->session_end (plugin->env->cls, &s->target, s); | 255 | plugin->env->session_end (plugin->env->cls, &s->target, s); |
262 | 256 | ||
263 | GNUNET_assert (GNUNET_YES == | 257 | GNUNET_assert (GNUNET_YES == |
@@ -389,10 +383,8 @@ unix_real_send (void *cls, | |||
389 | 383 | ||
390 | if (send_handle == NULL) | 384 | if (send_handle == NULL) |
391 | { | 385 | { |
392 | #if DEBUG_UNIX | ||
393 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 386 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
394 | "unix_real_send with send_handle NULL!\n"); | 387 | "unix_real_send with send_handle NULL!\n"); |
395 | #endif | ||
396 | /* failed to open send socket for AF */ | 388 | /* failed to open send socket for AF */ |
397 | if (cont != NULL) | 389 | if (cont != NULL) |
398 | cont (cont_cls, target, GNUNET_SYSERR); | 390 | cont (cont_cls, target, GNUNET_SYSERR); |
@@ -400,10 +392,8 @@ unix_real_send (void *cls, | |||
400 | } | 392 | } |
401 | if ((addr == NULL) || (addrlen == 0)) | 393 | if ((addr == NULL) || (addrlen == 0)) |
402 | { | 394 | { |
403 | #if DEBUG_UNIX | ||
404 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 395 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
405 | "unix_real_send called without address, returning!\n"); | 396 | "unix_real_send called without address, returning!\n"); |
406 | #endif | ||
407 | if (cont != NULL) | 397 | if (cont != NULL) |
408 | cont (cont_cls, target, GNUNET_SYSERR); | 398 | cont (cont_cls, target, GNUNET_SYSERR); |
409 | return 0; /* Can never send if we don't have an address!! */ | 399 | return 0; /* Can never send if we don't have an address!! */ |
@@ -460,13 +450,10 @@ unix_real_send (void *cls, | |||
460 | } | 450 | } |
461 | } | 451 | } |
462 | } | 452 | } |
463 | |||
464 | #if DEBUG_UNIX | ||
465 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 453 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
466 | "UNIX transmit %u-byte message to %s (%d: %s)\n", | 454 | "UNIX transmit %u-byte message to %s (%d: %s)\n", |
467 | (unsigned int) msgbuf_size, GNUNET_a2s (sb, sbs), (int) sent, | 455 | (unsigned int) msgbuf_size, GNUNET_a2s (sb, sbs), (int) sent, |
468 | (sent < 0) ? STRERROR (errno) : "ok"); | 456 | (sent < 0) ? STRERROR (errno) : "ok"); |
469 | #endif | ||
470 | /* Calling continuation */ | 457 | /* Calling continuation */ |
471 | if (cont != NULL) | 458 | if (cont != NULL) |
472 | { | 459 | { |
@@ -502,9 +489,7 @@ get_session_it (void *cls, const GNUNET_HashCode * key, void *value) | |||
502 | struct gsi_ctx *gsi = cls; | 489 | struct gsi_ctx *gsi = cls; |
503 | struct Session *s = value; | 490 | struct Session *s = value; |
504 | 491 | ||
505 | #if DEBUG_UNIX | ||
506 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Comparing session %s %s\n", gsi->address, s->addr); | 492 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Comparing session %s %s\n", gsi->address, s->addr); |
507 | #endif | ||
508 | if ((gsi->addrlen == s->addrlen) && | 493 | if ((gsi->addrlen == s->addrlen) && |
509 | (0 == memcmp (gsi->address, s->addr, s->addrlen))) | 494 | (0 == memcmp (gsi->address, s->addr, s->addrlen))) |
510 | { | 495 | { |
@@ -541,9 +526,7 @@ unix_plugin_get_session (void *cls, | |||
541 | GNUNET_CONTAINER_multihashmap_get_multiple (plugin->session_map, &address->peer.hashPubKey, &get_session_it, &gsi); | 526 | GNUNET_CONTAINER_multihashmap_get_multiple (plugin->session_map, &address->peer.hashPubKey, &get_session_it, &gsi); |
542 | if (gsi.res != NULL) | 527 | if (gsi.res != NULL) |
543 | { | 528 | { |
544 | #if DEBUG_UNIX | ||
545 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found existing session\n"); | 529 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found existing session\n"); |
546 | #endif | ||
547 | return gsi.res; | 530 | return gsi.res; |
548 | } | 531 | } |
549 | 532 | ||
@@ -563,11 +546,7 @@ unix_plugin_get_session (void *cls, | |||
563 | "# UNIX sessions active", | 546 | "# UNIX sessions active", |
564 | GNUNET_CONTAINER_multihashmap_size(plugin->session_map), | 547 | GNUNET_CONTAINER_multihashmap_size(plugin->session_map), |
565 | GNUNET_NO); | 548 | GNUNET_NO); |
566 | 549 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating new session\n"); | |
567 | #if DEBUG_UNIX | ||
568 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating new session\n"); | ||
569 | #endif | ||
570 | |||
571 | return s; | 550 | return s; |
572 | } | 551 | } |
573 | 552 | ||
@@ -657,11 +636,8 @@ unix_plugin_send (void *cls, | |||
657 | GNUNET_STATISTICS_set (plugin->env->stats,"# UNIX bytes in send queue", | 636 | GNUNET_STATISTICS_set (plugin->env->stats,"# UNIX bytes in send queue", |
658 | plugin->bytes_in_queue, GNUNET_NO); | 637 | plugin->bytes_in_queue, GNUNET_NO); |
659 | 638 | ||
660 | #if DEBUG_UNIX | ||
661 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sent %d bytes to `%s'\n", ssize, | 639 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sent %d bytes to `%s'\n", ssize, |
662 | (char *) session->addr); | 640 | (char *) session->addr); |
663 | #endif | ||
664 | |||
665 | if (plugin->with_ws == GNUNET_NO) | 641 | if (plugin->with_ws == GNUNET_NO) |
666 | { | 642 | { |
667 | if (plugin->select_task != GNUNET_SCHEDULER_NO_TASK) | 643 | if (plugin->select_task != GNUNET_SCHEDULER_NO_TASK) |
@@ -702,10 +678,8 @@ unix_demultiplexer (struct Plugin *plugin, struct GNUNET_PeerIdentity *sender, | |||
702 | 678 | ||
703 | GNUNET_assert (fromlen >= sizeof (struct sockaddr_un)); | 679 | GNUNET_assert (fromlen >= sizeof (struct sockaddr_un)); |
704 | 680 | ||
705 | #if DEBUG_UNIX | ||
706 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received message from %s\n", | 681 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received message from %s\n", |
707 | un->sun_path); | 682 | un->sun_path); |
708 | #endif | ||
709 | plugin->env->receive (plugin->env->cls, sender, currhdr, | 683 | plugin->env->receive (plugin->env->cls, sender, currhdr, |
710 | (const struct GNUNET_ATS_Information *) &ats, 2, | 684 | (const struct GNUNET_ATS_Information *) &ats, 2, |
711 | NULL, un->sun_path, strlen (un->sun_path) + 1); | 685 | NULL, un->sun_path, strlen (un->sun_path) + 1); |
@@ -747,10 +721,8 @@ unix_plugin_select_read (struct Plugin * plugin) | |||
747 | #if LINUX | 721 | #if LINUX |
748 | un.sun_path[0] = '/'; | 722 | un.sun_path[0] = '/'; |
749 | #endif | 723 | #endif |
750 | #if DEBUG_UNIX | ||
751 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Read %d bytes from socket %s\n", ret, | 724 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Read %d bytes from socket %s\n", ret, |
752 | &un.sun_path[0]); | 725 | &un.sun_path[0]); |
753 | #endif | ||
754 | } | 726 | } |
755 | 727 | ||
756 | GNUNET_assert (AF_UNIX == (un.sun_family)); | 728 | GNUNET_assert (AF_UNIX == (un.sun_family)); |
@@ -928,10 +900,8 @@ unix_transport_server_start (void *cls) | |||
928 | plugin->unix_sock.desc = NULL; | 900 | plugin->unix_sock.desc = NULL; |
929 | return GNUNET_SYSERR; | 901 | return GNUNET_SYSERR; |
930 | } | 902 | } |
931 | #if DEBUG_UNIX | ||
932 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "unix", "Bound to `%s'\n", | 903 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "unix", "Bound to `%s'\n", |
933 | &un.sun_path[0]); | 904 | &un.sun_path[0]); |
934 | #endif | ||
935 | plugin->rs = GNUNET_NETWORK_fdset_create (); | 905 | plugin->rs = GNUNET_NETWORK_fdset_create (); |
936 | plugin->ws = GNUNET_NETWORK_fdset_create (); | 906 | plugin->ws = GNUNET_NETWORK_fdset_create (); |
937 | GNUNET_NETWORK_fdset_zero (plugin->rs); | 907 | GNUNET_NETWORK_fdset_zero (plugin->rs); |
@@ -970,12 +940,9 @@ unix_transport_server_start (void *cls) | |||
970 | static int | 940 | static int |
971 | unix_check_address (void *cls, const void *addr, size_t addrlen) | 941 | unix_check_address (void *cls, const void *addr, size_t addrlen) |
972 | { | 942 | { |
973 | |||
974 | #if DEBUG_UNIX | ||
975 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 943 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
976 | "Informing transport service about my address `%s'\n", | 944 | "Informing transport service about my address `%s'\n", |
977 | (char *) addr); | 945 | (char *) addr); |
978 | #endif | ||
979 | return GNUNET_OK; | 946 | return GNUNET_OK; |
980 | } | 947 | } |
981 | 948 | ||