aboutsummaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c47
1 files changed, 29 insertions, 18 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index f5fd388d5..34ec1eaeb 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -1258,11 +1258,6 @@ GST_neighbours_switch_to_address_3way (const struct GNUNET_PeerIdentity *peer,
1258 ret = send_with_plugin(&n->id, (const void *) &connect_msg, msg_len, UINT32_MAX, GNUNET_TIME_UNIT_FOREVER_REL, 1258 ret = send_with_plugin(&n->id, (const void *) &connect_msg, msg_len, UINT32_MAX, GNUNET_TIME_UNIT_FOREVER_REL,
1259 session, plugin_name, address, address_len, 1259 session, plugin_name, address, address_len,
1260 GNUNET_YES, &send_connect_ack_continuation, n); 1260 GNUNET_YES, &send_connect_ack_continuation, n);
1261 if (ret == GNUNET_SYSERR)
1262 {
1263 change_state (n, S_NOT_CONNECTED);
1264 GNUNET_break (0);
1265 }
1266 return GNUNET_NO; 1261 return GNUNET_NO;
1267 } 1262 }
1268 /* connected peer is switching addresses */ 1263 /* connected peer is switching addresses */
@@ -1713,7 +1708,7 @@ neighbours_iterate (void *cls, const GNUNET_HashCode * key, void *value)
1713 struct IteratorContext *ic = cls; 1708 struct IteratorContext *ic = cls;
1714 struct NeighbourMapEntry *n = value; 1709 struct NeighbourMapEntry *n = value;
1715 1710
1716 if (is_connected(n)) 1711 if (!is_connected(n))
1717 return GNUNET_OK; 1712 return GNUNET_OK;
1718 1713
1719 ic->cb (ic->cb_cls, &n->id, NULL, 0, n->plugin_name, n->addr, n->addrlen); 1714 ic->cb (ic->cb_cls, &n->id, NULL, 0, n->plugin_name, n->addr, n->addrlen);
@@ -1944,7 +1939,17 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message,
1944 neighbours_connected++; 1939 neighbours_connected++;
1945 GNUNET_STATISTICS_update (GST_stats, gettext_noop ("# peers connected"), 1, 1940 GNUNET_STATISTICS_update (GST_stats, gettext_noop ("# peers connected"), 1,
1946 GNUNET_NO); 1941 GNUNET_NO);
1942#if DEBUG_TRANSPORT
1943 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1944 "Notify about connect of `%4s' using plugin `%s' address '%s' session %X LINE %u\n",
1945 GNUNET_i2s (&n->id), n->plugin_name,
1946 (n->addrlen == 0) ? "<inbound>" : GST_plugins_a2s (n->plugin_name,
1947 n->addr,
1948 n->addrlen),
1949 n->session, __LINE__);
1950#endif
1947 connect_notify_cb (callback_cls, &n->id, ats, ats_count); 1951 connect_notify_cb (callback_cls, &n->id, ats, ats_count);
1952 }
1948 1953
1949#if DEBUG_TRANSPORT 1954#if DEBUG_TRANSPORT
1950 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1955 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1956,7 +1961,7 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message,
1956 q_msg.quota = n->bandwidth_out; 1961 q_msg.quota = n->bandwidth_out;
1957 q_msg.peer = (*peer); 1962 q_msg.peer = (*peer);
1958 GST_clients_broadcast (&q_msg.header, GNUNET_NO); 1963 GST_clients_broadcast (&q_msg.header, GNUNET_NO);
1959 } 1964
1960} 1965}
1961 1966
1962void 1967void
@@ -1970,6 +1975,7 @@ GST_neighbours_handle_ack (const struct GNUNET_MessageHeader *message,
1970{ 1975{
1971 struct NeighbourMapEntry *n; 1976 struct NeighbourMapEntry *n;
1972 struct QuotaSetMessage q_msg; 1977 struct QuotaSetMessage q_msg;
1978 int was_connected;
1973 1979
1974#if DEBUG_TRANSPORT 1980#if DEBUG_TRANSPORT
1975 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1981 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1988,16 +1994,7 @@ GST_neighbours_handle_ack (const struct GNUNET_MessageHeader *message,
1988 send_disconnect(n); 1994 send_disconnect(n);
1989 GNUNET_break (0); 1995 GNUNET_break (0);
1990 } 1996 }
1991// FIXME check this 1997
1992// if (n->state != S_CONNECT_RECV)
1993/* if (is_connecting(n))
1994 {
1995 send_disconnect (n);
1996 change_state (n, S_DISCONNECT);
1997 GNUNET_break (0);
1998 return;
1999 }
2000*/
2001 if (is_connected(n)) 1998 if (is_connected(n))
2002 return; 1999 return;
2003 2000
@@ -2013,6 +2010,7 @@ GST_neighbours_handle_ack (const struct GNUNET_MessageHeader *message,
2013 plugin_name, sender_address, sender_address_len, 2010 plugin_name, sender_address, sender_address_len,
2014 session, ats, ats_count); 2011 session, ats, ats_count);
2015 2012
2013 was_connected = is_connected(n);
2016 change_state (n, S_CONNECTED); 2014 change_state (n, S_CONNECTED);
2017 2015
2018 GST_neighbours_set_incoming_quota(&n->id, n->bandwidth_in); 2016 GST_neighbours_set_incoming_quota(&n->id, n->bandwidth_in);
@@ -2022,12 +2020,24 @@ GST_neighbours_handle_ack (const struct GNUNET_MessageHeader *message,
2022 &neighbour_keepalive_task, 2020 &neighbour_keepalive_task,
2023 n); 2021 n);
2024 2022
2023 if (!was_connected)
2024 {
2025 neighbours_connected++; 2025 neighbours_connected++;
2026 GNUNET_STATISTICS_update (GST_stats, gettext_noop ("# peers connected"), 1, 2026 GNUNET_STATISTICS_update (GST_stats, gettext_noop ("# peers connected"), 1,
2027 GNUNET_NO); 2027 GNUNET_NO);
2028 connect_notify_cb (callback_cls, &n->id, ats, ats_count);
2029 2028
2030#if DEBUG_TRANSPORT 2029#if DEBUG_TRANSPORT
2030 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2031 "Notify about connect of `%4s' using plugin `%s' address '%s' session %X LINE %u\n",
2032 GNUNET_i2s (&n->id), n->plugin_name,
2033 (n->addrlen == 0) ? "<inbound>" : GST_plugins_a2s (n->plugin_name,
2034 n->addr,
2035 n->addrlen),
2036 n->session, __LINE__);
2037#endif
2038 connect_notify_cb (callback_cls, &n->id, ats, ats_count);
2039 }
2040#if DEBUG_TRANSPORT
2031 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2041 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2032 "Sending outbound quota of %u Bps for peer `%s' to all clients\n", 2042 "Sending outbound quota of %u Bps for peer `%s' to all clients\n",
2033 ntohl (n->bandwidth_out.value__), GNUNET_i2s (peer)); 2043 ntohl (n->bandwidth_out.value__), GNUNET_i2s (peer));
@@ -2038,6 +2048,7 @@ GST_neighbours_handle_ack (const struct GNUNET_MessageHeader *message,
2038 q_msg.quota = n->bandwidth_out; 2048 q_msg.quota = n->bandwidth_out;
2039 q_msg.peer = (*peer); 2049 q_msg.peer = (*peer);
2040 GST_clients_broadcast (&q_msg.header, GNUNET_NO); 2050 GST_clients_broadcast (&q_msg.header, GNUNET_NO);
2051
2041} 2052}
2042 2053
2043struct BlackListCheckContext 2054struct BlackListCheckContext