diff options
author | t3sserakt <t3ss@posteo.de> | 2021-08-24 11:56:13 +0200 |
---|---|---|
committer | t3sserakt <t3ss@posteo.de> | 2021-08-24 11:56:13 +0200 |
commit | 5ddaa3f8eb5e01882540f21ddf237f3a41311e8a (patch) | |
tree | 765617baebf4366c9584d71863c3077f5d107d49 /src/transport/gnunet-communicator-tcp.c | |
parent | 9d5a8c05f3a33c49fd97e5b8ef99d58b96704c6d (diff) | |
download | gnunet-5ddaa3f8eb5e01882540f21ddf237f3a41311e8a.tar.gz gnunet-5ddaa3f8eb5e01882540f21ddf237f3a41311e8a.zip |
- fixed mem leaks, added code doc, formatting, removed trace logs
Diffstat (limited to 'src/transport/gnunet-communicator-tcp.c')
-rw-r--r-- | src/transport/gnunet-communicator-tcp.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/transport/gnunet-communicator-tcp.c b/src/transport/gnunet-communicator-tcp.c index 10e2f7d40..d8bf7c1a8 100644 --- a/src/transport/gnunet-communicator-tcp.c +++ b/src/transport/gnunet-communicator-tcp.c | |||
@@ -879,12 +879,15 @@ queue_destroy (struct Queue *queue) | |||
879 | struct GNUNET_HashCode h_sock; | 879 | struct GNUNET_HashCode h_sock; |
880 | int sockfd; | 880 | int sockfd; |
881 | 881 | ||
882 | sockfd = GNUNET_NETWORK_get_fd (queue->listen_sock); | 882 | if (NULL != queue->listen_sock) |
883 | GNUNET_CRYPTO_hash (&sockfd, | 883 | { |
884 | sizeof(int), | 884 | sockfd = GNUNET_NETWORK_get_fd (queue->listen_sock); |
885 | &h_sock); | 885 | GNUNET_CRYPTO_hash (&sockfd, |
886 | sizeof(int), | ||
887 | &h_sock); | ||
886 | 888 | ||
887 | lt = GNUNET_CONTAINER_multihashmap_get (lt_map, &h_sock); | 889 | lt = GNUNET_CONTAINER_multihashmap_get (lt_map, &h_sock); |
890 | } | ||
888 | 891 | ||
889 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 892 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
890 | "Disconnecting queue for peer `%s'\n", | 893 | "Disconnecting queue for peer `%s'\n", |
@@ -1900,9 +1903,9 @@ queue_read (void *cls) | |||
1900 | BUF_SIZE - queue->cread_off); | 1903 | BUF_SIZE - queue->cread_off); |
1901 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1904 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1902 | "Received %lu bytes from TCP queue\n", rcvd); | 1905 | "Received %lu bytes from TCP queue\n", rcvd); |
1903 | GNUNET_log_from_nocheck (GNUNET_ERROR_TYPE_DEBUG, | 1906 | GNUNET_log_from_nocheck (GNUNET_ERROR_TYPE_DEBUG, |
1904 | "transport", | 1907 | "transport", |
1905 | "Received %lu bytes from TCP queue\n", rcvd); | 1908 | "Received %lu bytes from TCP queue\n", rcvd); |
1906 | if (-1 == rcvd) | 1909 | if (-1 == rcvd) |
1907 | { | 1910 | { |
1908 | if ((EAGAIN != errno) && (EINTR != errno)) | 1911 | if ((EAGAIN != errno) && (EINTR != errno)) |
@@ -2678,9 +2681,9 @@ proto_read_kx (void *cls) | |||
2678 | sizeof(pq->ibuf) - pq->ibuf_off); | 2681 | sizeof(pq->ibuf) - pq->ibuf_off); |
2679 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2682 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2680 | "Received %lu bytes for KX\n", rcvd); | 2683 | "Received %lu bytes for KX\n", rcvd); |
2681 | GNUNET_log_from_nocheck (GNUNET_ERROR_TYPE_DEBUG, | 2684 | GNUNET_log_from_nocheck (GNUNET_ERROR_TYPE_DEBUG, |
2682 | "transport", | 2685 | "transport", |
2683 | "Received %lu bytes for KX\n", rcvd); | 2686 | "Received %lu bytes for KX\n", rcvd); |
2684 | if (-1 == rcvd) | 2687 | if (-1 == rcvd) |
2685 | { | 2688 | { |
2686 | if ((EAGAIN != errno) && (EINTR != errno)) | 2689 | if ((EAGAIN != errno) && (EINTR != errno)) |
@@ -2830,10 +2833,10 @@ queue_read_kx (void *cls) | |||
2830 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2833 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2831 | "Received %lu bytes for KX\n", | 2834 | "Received %lu bytes for KX\n", |
2832 | rcvd); | 2835 | rcvd); |
2833 | GNUNET_log_from_nocheck (GNUNET_ERROR_TYPE_DEBUG, | 2836 | GNUNET_log_from_nocheck (GNUNET_ERROR_TYPE_DEBUG, |
2834 | "transport", | 2837 | "transport", |
2835 | "Received %lu bytes for KX\n", | 2838 | "Received %lu bytes for KX\n", |
2836 | rcvd); | 2839 | rcvd); |
2837 | if (-1 == rcvd) | 2840 | if (-1 == rcvd) |
2838 | { | 2841 | { |
2839 | if ((EAGAIN != errno) && (EINTR != errno)) | 2842 | if ((EAGAIN != errno) && (EINTR != errno)) |
@@ -3082,9 +3085,9 @@ do_shutdown (void *cls) | |||
3082 | GNUNET_CONTAINER_multihashmap_iterate (lt_map, &get_lt_delete_it, NULL); | 3085 | GNUNET_CONTAINER_multihashmap_iterate (lt_map, &get_lt_delete_it, NULL); |
3083 | GNUNET_CONTAINER_multipeermap_iterate (queue_map, &get_queue_delete_it, NULL); | 3086 | GNUNET_CONTAINER_multipeermap_iterate (queue_map, &get_queue_delete_it, NULL); |
3084 | GNUNET_CONTAINER_multipeermap_destroy (queue_map); | 3087 | GNUNET_CONTAINER_multipeermap_destroy (queue_map); |
3085 | GNUNET_TRANSPORT_communicator_address_remove_all (ch); | ||
3086 | if (NULL != ch) | 3088 | if (NULL != ch) |
3087 | { | 3089 | { |
3090 | GNUNET_TRANSPORT_communicator_address_remove_all (ch); | ||
3088 | GNUNET_TRANSPORT_communicator_disconnect (ch); | 3091 | GNUNET_TRANSPORT_communicator_disconnect (ch); |
3089 | ch = NULL; | 3092 | ch = NULL; |
3090 | } | 3093 | } |