summaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2011-10-28 16:50:53 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2011-10-28 16:50:53 +0000
commit2dfaab4b6c0dc6cdad4ed017833d94a3020e97e1 (patch)
tree11f1cc6b153e8a5e01fe24fceefd6c53c47369e4 /src/transport
parentdb08ac0c2ad4d1b98aefc10c798d58f5ce237222 (diff)
fixing transport_api.c:484 assertion
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,
ret = send_with_plugin(&n->id, (const void *) &connect_msg, msg_len, UINT32_MAX, GNUNET_TIME_UNIT_FOREVER_REL,
session, plugin_name, address, address_len,
GNUNET_YES, &send_connect_ack_continuation, n);
- if (ret == GNUNET_SYSERR)
- {
- change_state (n, S_NOT_CONNECTED);
- GNUNET_break (0);
- }
return GNUNET_NO;
}
/* connected peer is switching addresses */
@@ -1713,7 +1708,7 @@ neighbours_iterate (void *cls, const GNUNET_HashCode * key, void *value)
struct IteratorContext *ic = cls;
struct NeighbourMapEntry *n = value;
- if (is_connected(n))
+ if (!is_connected(n))
return GNUNET_OK;
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,
neighbours_connected++;
GNUNET_STATISTICS_update (GST_stats, gettext_noop ("# peers connected"), 1,
GNUNET_NO);
+#if DEBUG_TRANSPORT
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Notify about connect of `%4s' using plugin `%s' address '%s' session %X LINE %u\n",
+ GNUNET_i2s (&n->id), n->plugin_name,
+ (n->addrlen == 0) ? "<inbound>" : GST_plugins_a2s (n->plugin_name,
+ n->addr,
+ n->addrlen),
+ n->session, __LINE__);
+#endif
connect_notify_cb (callback_cls, &n->id, ats, ats_count);
+ }
#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1956,7 +1961,7 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message,
q_msg.quota = n->bandwidth_out;
q_msg.peer = (*peer);
GST_clients_broadcast (&q_msg.header, GNUNET_NO);
- }
+
}
void
@@ -1970,6 +1975,7 @@ GST_neighbours_handle_ack (const struct GNUNET_MessageHeader *message,
{
struct NeighbourMapEntry *n;
struct QuotaSetMessage q_msg;
+ int was_connected;
#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1988,16 +1994,7 @@ GST_neighbours_handle_ack (const struct GNUNET_MessageHeader *message,
send_disconnect(n);
GNUNET_break (0);
}
-// FIXME check this
-// if (n->state != S_CONNECT_RECV)
-/* if (is_connecting(n))
- {
- send_disconnect (n);
- change_state (n, S_DISCONNECT);
- GNUNET_break (0);
- return;
- }
-*/
+
if (is_connected(n))
return;
@@ -2013,6 +2010,7 @@ GST_neighbours_handle_ack (const struct GNUNET_MessageHeader *message,
plugin_name, sender_address, sender_address_len,
session, ats, ats_count);
+ was_connected = is_connected(n);
change_state (n, S_CONNECTED);
GST_neighbours_set_incoming_quota(&n->id, n->bandwidth_in);
@@ -2022,12 +2020,24 @@ GST_neighbours_handle_ack (const struct GNUNET_MessageHeader *message,
&neighbour_keepalive_task,
n);
+ if (!was_connected)
+ {
neighbours_connected++;
GNUNET_STATISTICS_update (GST_stats, gettext_noop ("# peers connected"), 1,
GNUNET_NO);
- connect_notify_cb (callback_cls, &n->id, ats, ats_count);
#if DEBUG_TRANSPORT
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Notify about connect of `%4s' using plugin `%s' address '%s' session %X LINE %u\n",
+ GNUNET_i2s (&n->id), n->plugin_name,
+ (n->addrlen == 0) ? "<inbound>" : GST_plugins_a2s (n->plugin_name,
+ n->addr,
+ n->addrlen),
+ n->session, __LINE__);
+#endif
+ connect_notify_cb (callback_cls, &n->id, ats, ats_count);
+ }
+#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Sending outbound quota of %u Bps for peer `%s' to all clients\n",
ntohl (n->bandwidth_out.value__), GNUNET_i2s (peer));
@@ -2038,6 +2048,7 @@ GST_neighbours_handle_ack (const struct GNUNET_MessageHeader *message,
q_msg.quota = n->bandwidth_out;
q_msg.peer = (*peer);
GST_clients_broadcast (&q_msg.header, GNUNET_NO);
+
}
struct BlackListCheckContext