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 */
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);
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,
q_msg.quota = n->bandwidth_out;
q_msg.peer = (*peer);
GST_clients_broadcast (&q_msg.header, GNUNET_NO);
- }
+
}
void
{
struct NeighbourMapEntry *n;
struct QuotaSetMessage q_msg;
+ int was_connected;
#if DEBUG_TRANSPORT
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
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;
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);
&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",
q_msg.quota = n->bandwidth_out;
q_msg.peer = (*peer);
GST_clients_broadcast (&q_msg.header, GNUNET_NO);
+
}
struct BlackListCheckContext