* Flag to set if we still need to send a CONNECT_ACK message to the other peer
* (once we have an address to use and the peer has been allowed by our
* blacklist). Initially set to #ACK_UNDEFINED. Set to #ACK_SEND_CONNECT_ACK
- * if we need to send a CONNECT_ACK. Set to #SESSION_ACK if we did
+ * if we need to send a CONNECT_ACK. Set to #ACK_SEND_SESSION_ACK if we did
* send a CONNECT_ACK and should go to 'S_CONNECTED' upon receiving a
* 'SESSION_ACK' (regardless of what our own state machine might say).
*/
/**
- * Context for blacklist checks and the #handle_test_blacklist_cont()
+ * Context for blacklist checks and the #try_connect_bl_check_cont()
* function. Stores information about ongoing blacklist checks.
*/
struct BlackListCheckContext
/* struct NeighbourMapEntry *n = cls; */
struct QuotaNotificationRequest *qnr = value;
- GNUNET_CONTAINER_multipeermap_remove (registered_quota_notifications, key,
- qnr);
+ GNUNET_break (GNUNET_OK != GNUNET_CONTAINER_multipeermap_remove (registered_quota_notifications, key,
+ qnr));
GNUNET_free(qnr->plugin);
GNUNET_free(qnr);
struct GNUNET_TRANSPORT_PluginFunctions *papi;
struct NeighbourMapEntry *n;
+ papi = GST_plugins_find (blc_ctx->address->transport_name);
+
if ( (NULL == (n = lookup_neighbour (peer))) || (result == GNUNET_NO) ||
- (NULL == (papi = GST_plugins_find (blc_ctx->address->transport_name))) )
+ (NULL == (papi)) )
{
if (NULL == n)
{
blc_ctx->session,
GNUNET_i2s (&blc_ctx->address->peer));
}
- if (NULL == (papi = GST_plugins_find (blc_ctx->address->transport_name)))
+ if (NULL == papi)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Plugin `%s' for suggested address `%s' session %p for peer `%s' is not available\n",
{
struct NeighbourMapEntry *n;
struct GST_BlacklistCheck *blc;
- struct GNUNET_TRANSPORT_PluginFunctions *papi;
struct BlacklistCheckSwitchContext *blc_ctx;
int c;
}
/* Check if plugin is available */
- if (NULL == (papi = GST_plugins_find (address->transport_name)))
+ if (NULL == (GST_plugins_find (address->transport_name)))
{
/* we don't have the plugin for this address */
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
now wait for the ACK to finally be connected
- If we sent a CONNECT_ACK to this peer before */
- if ( (GNUNET_TRANSPORT_PS_CONNECT_RECV_ACK != n->state) ||
+ if ( (GNUNET_TRANSPORT_PS_CONNECT_RECV_ACK != n->state) &&
(ACK_SEND_SESSION_ACK != n->ack_state))
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Received unexpected SESSION_ACK message from peer `%s' in state %s/%s\n",
GNUNET_i2s (peer),
GNUNET_TRANSPORT_ps2s (n->state),
}
/* We are connected */
- set_state_and_timeout (n, GNUNET_TRANSPORT_PS_CONNECTED, GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT));
- GNUNET_STATISTICS_set (GST_stats,
- gettext_noop ("# peers connected"),
- ++neighbours_connected,
- GNUNET_NO);
-
- /* Notify about connection */
- connect_notify_cb (callback_cls, &n->id,
+ if (GNUNET_NO == GST_neighbours_test_connected(&n->id))
+ {
+ /* Notify about connection */
+ connect_notify_cb (callback_cls, &n->id,
n->primary_address.bandwidth_in,
- n->primary_address.bandwidth_out);
+ n->primary_address.bandwidth_out);\
+
+ GNUNET_STATISTICS_set (GST_stats,
+ gettext_noop ("# peers connected"),
+ ++neighbours_connected,
+ GNUNET_NO);
+ }
+
+ set_state_and_timeout (n, GNUNET_TRANSPORT_PS_CONNECTED,
+ GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT));
/* Add session to ATS since no session was given (NULL) and we may have
* obtained a new session */