diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-10-31 12:16:19 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-10-31 12:16:19 +0000 |
commit | c000dc65144c193d4e099e15b70e8ef0b33b9c59 (patch) | |
tree | aeb316b6a4852421c08d5fd2360dd5a7d6e57c3a /src/transport/gnunet-service-transport_neighbours.c | |
parent | dbaf62fe92cdd39b8c76c958d2ecf6054f3ca8ba (diff) | |
download | gnunet-c000dc65144c193d4e099e15b70e8ef0b33b9c59.tar.gz gnunet-c000dc65144c193d4e099e15b70e8ef0b33b9c59.zip |
do not call send_disconnect with NULL
Diffstat (limited to 'src/transport/gnunet-service-transport_neighbours.c')
-rw-r--r-- | src/transport/gnunet-service-transport_neighbours.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index e2af74030..6011ad249 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c | |||
@@ -764,21 +764,24 @@ send_disconnect_cont (void *cls, | |||
764 | int result) | 764 | int result) |
765 | { | 765 | { |
766 | #if DEBUG_TRANSPORT | 766 | #if DEBUG_TRANSPORT |
767 | struct NeighbourMapEntry *n = cls; | ||
768 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending DISCONNECT message to peer `%4s': %i\n", | 767 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending DISCONNECT message to peer `%4s': %i\n", |
769 | GNUNET_i2s (&n->id), result); | 768 | GNUNET_i2s (target), result); |
770 | #endif | 769 | #endif |
771 | } | 770 | } |
772 | 771 | ||
772 | |||
773 | static int | 773 | static int |
774 | send_disconnect (struct NeighbourMapEntry *n) | 774 | send_disconnect (const struct GNUNET_PeerIdentity * target, |
775 | const char *plugin_name, | ||
776 | const char *sender_address, uint16_t sender_address_len, | ||
777 | struct Session *session) | ||
775 | { | 778 | { |
776 | size_t ret; | 779 | size_t ret; |
777 | struct SessionDisconnectMessage disconnect_msg; | 780 | struct SessionDisconnectMessage disconnect_msg; |
778 | 781 | ||
779 | #if DEBUG_TRANSPORT | 782 | #if DEBUG_TRANSPORT |
780 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending DISCONNECT message to peer `%4s'\n", | 783 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending DISCONNECT message to peer `%4s'\n", |
781 | GNUNET_i2s (&n->id)); | 784 | GNUNET_i2s (target)); |
782 | #endif | 785 | #endif |
783 | 786 | ||
784 | disconnect_msg.header.size = htons (sizeof (struct SessionDisconnectMessage)); | 787 | disconnect_msg.header.size = htons (sizeof (struct SessionDisconnectMessage)); |
@@ -795,10 +798,11 @@ send_disconnect (struct NeighbourMapEntry *n) | |||
795 | &disconnect_msg.purpose, | 798 | &disconnect_msg.purpose, |
796 | &disconnect_msg.signature)); | 799 | &disconnect_msg.signature)); |
797 | 800 | ||
798 | ret = send_with_plugin(&n->id, (const char *) &disconnect_msg, sizeof (disconnect_msg), | 801 | ret = send_with_plugin(target, |
799 | UINT32_MAX, GNUNET_TIME_UNIT_FOREVER_REL, | 802 | (const char *) &disconnect_msg, sizeof (disconnect_msg), |
800 | n->session, n->plugin_name, n->addr, n->addrlen, | 803 | UINT32_MAX, GNUNET_TIME_UNIT_FOREVER_REL, |
801 | GNUNET_YES, &send_disconnect_cont, n); | 804 | session, plugin_name, sender_address, sender_address_len, |
805 | GNUNET_YES, &send_disconnect_cont, NULL); | ||
802 | 806 | ||
803 | if (ret == GNUNET_SYSERR) | 807 | if (ret == GNUNET_SYSERR) |
804 | return GNUNET_SYSERR; | 808 | return GNUNET_SYSERR; |
@@ -823,7 +827,7 @@ disconnect_neighbour (struct NeighbourMapEntry *n) | |||
823 | /* send DISCONNECT MESSAGE */ | 827 | /* send DISCONNECT MESSAGE */ |
824 | if (is_connected(n) || is_connecting(n)) | 828 | if (is_connected(n) || is_connecting(n)) |
825 | { | 829 | { |
826 | if (GNUNET_OK == send_disconnect(n)) | 830 | if (GNUNET_OK == send_disconnect(&n->id, n->plugin_name, n->addr, n->addrlen, n->session)) |
827 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sent DISCONNECT_MSG to `%s'\n", | 831 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sent DISCONNECT_MSG to `%s'\n", |
828 | GNUNET_i2s (&n->id)); | 832 | GNUNET_i2s (&n->id)); |
829 | else | 833 | else |
@@ -1783,7 +1787,7 @@ GST_neighbours_force_disconnect (const struct GNUNET_PeerIdentity *target) | |||
1783 | return; /* not active */ | 1787 | return; /* not active */ |
1784 | if (is_connected(n)) | 1788 | if (is_connected(n)) |
1785 | { | 1789 | { |
1786 | send_disconnect(n); | 1790 | send_disconnect(&n->id, n->plugin_name, n->addr, n->addrlen, n->session); |
1787 | 1791 | ||
1788 | n = lookup_neighbour (target); | 1792 | n = lookup_neighbour (target); |
1789 | if (NULL == n) | 1793 | if (NULL == n) |
@@ -1914,7 +1918,7 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message, | |||
1914 | if (n->state != S_CONNECT_SENT) | 1918 | if (n->state != S_CONNECT_SENT) |
1915 | { | 1919 | { |
1916 | GNUNET_break (0); | 1920 | GNUNET_break (0); |
1917 | send_disconnect(n); | 1921 | send_disconnect(&n->id, n->plugin_name, n->addr, n->addrlen, n->session); |
1918 | return; | 1922 | return; |
1919 | } | 1923 | } |
1920 | */ | 1924 | */ |
@@ -2023,7 +2027,7 @@ GST_neighbours_handle_ack (const struct GNUNET_MessageHeader *message, | |||
2023 | n = lookup_neighbour (peer); | 2027 | n = lookup_neighbour (peer); |
2024 | if (NULL == n) | 2028 | if (NULL == n) |
2025 | { | 2029 | { |
2026 | send_disconnect(n); | 2030 | send_disconnect(peer, plugin_name, sender_address, sender_address_len, session); |
2027 | GNUNET_break (0); | 2031 | GNUNET_break (0); |
2028 | } | 2032 | } |
2029 | 2033 | ||