[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r18068 - gnunet/src/transport
From: |
gnunet |
Subject: |
[GNUnet-SVN] r18068 - gnunet/src/transport |
Date: |
Wed, 9 Nov 2011 12:53:04 +0100 |
Author: grothoff
Date: 2011-11-09 12:53:04 +0100 (Wed, 09 Nov 2011)
New Revision: 18068
Modified:
gnunet/src/transport/gnunet-service-transport_neighbours.c
Log:
assertions and minor cleanup
Modified: gnunet/src/transport/gnunet-service-transport_neighbours.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_neighbours.c 2011-11-09
11:06:30 UTC (rev 18067)
+++ gnunet/src/transport/gnunet-service-transport_neighbours.c 2011-11-09
11:53:04 UTC (rev 18068)
@@ -819,10 +819,12 @@
disconnect_neighbour (struct NeighbourMapEntry *n)
{
struct MessageQueue *mq;
- int was_connected = is_connected (n);
+ int is_connected;
+ is_connected = (n->state == S_CONNECTED);
+
/* send DISCONNECT MESSAGE */
- if (is_connected (n) || is_connecting (n))
+ if (is_connected || is_connecting (n))
{
if (GNUNET_OK ==
send_disconnect (&n->id, n->address,
@@ -835,7 +837,7 @@
GNUNET_i2s (&n->id));
}
- if (is_connected(n))
+ if (is_connected)
{
GNUNET_ATS_address_in_use (GST_ats, n->address, n->session, GNUNET_NO);
}
@@ -869,7 +871,7 @@
n->is_active->n = NULL;
n->is_active = NULL;
}
- if (was_connected)
+ if (is_connected)
{
GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != n->keepalive_task);
GNUNET_SCHEDULER_cancel (n->keepalive_task);
@@ -2053,6 +2055,7 @@
}
+
void
GST_neighbours_handle_ack (const struct GNUNET_MessageHeader *message,
const struct GNUNET_PeerIdentity *peer,
@@ -2063,10 +2066,10 @@
{
struct NeighbourMapEntry *n;
struct QuotaSetMessage q_msg;
- int was_connected;
#if DEBUG_TRANSPORT
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ACK message from peer `%s'\n",
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Received ACK message from peer `%s'\n",
GNUNET_i2s (peer));
#endif
@@ -2075,7 +2078,6 @@
GNUNET_break_op (0);
return;
}
-
n = lookup_neighbour (peer);
if (NULL == n)
{
@@ -2084,27 +2086,22 @@
GNUNET_break (0);
return;
}
-
if (is_connected (n))
return;
-
if (!is_connecting(n))
{
GNUNET_STATISTICS_update (GST_stats, gettext_noop ("# unexpected ACK
messages"), 1,
GNUNET_NO);
return;
}
-
if (NULL != session)
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK,
"transport-ats",
"Giving ATS session %p of plugin %s for peer %s\n",
session, address->transport_name, GNUNET_i2s (peer));
GNUNET_ATS_address_update (GST_ats, address, session, ats, ats_count);
-
- was_connected = is_connected (n);
+ GNUNET_assert (n->address != NULL);
change_state (n, S_CONNECTED);
-
GNUNET_ATS_address_in_use (GST_ats, n->address, n->session, GNUNET_YES);
GST_neighbours_set_incoming_quota (&n->id, n->bandwidth_in);
@@ -2113,26 +2110,22 @@
n->keepalive_task =
GNUNET_SCHEDULER_add_delayed (KEEPALIVE_FREQUENCY,
&neighbour_keepalive_task, n);
-
- if (!was_connected)
- {
- GST_validation_set_address_use (&n->id,
- n->address,
- n->session,
- GNUNET_YES);
- neighbours_connected++;
- GNUNET_STATISTICS_update (GST_stats, gettext_noop ("# peers connected"), 1,
- GNUNET_NO);
-
+ GST_validation_set_address_use (&n->id,
+ n->address,
+ n->session,
+ GNUNET_YES);
+ 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 address '%s' session %X
LINE %u\n",
- GNUNET_i2s (&n->id),
- GST_plugins_a2s (n->address), n->session,
- __LINE__);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Notify about connect of `%4s' using address '%s' session %X LINE
%u\n",
+ GNUNET_i2s (&n->id),
+ GST_plugins_a2s (n->address), n->session,
+ __LINE__);
#endif
- connect_notify_cb (callback_cls, &n->id, ats, ats_count);
- }
+ 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",
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r18068 - gnunet/src/transport,
gnunet <=