aboutsummaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-11-09 11:56:08 +0000
committerChristian Grothoff <christian@grothoff.org>2011-11-09 11:56:08 +0000
commit20f8436676445ff9ba5976333eea814e413c3043 (patch)
tree2829733122ab2eaba42701b08dc3fea011096a61 /src/transport
parent48394cb1b3140ffad691ed0da9f3a541c0e00b28 (diff)
downloadgnunet-20f8436676445ff9ba5976333eea814e413c3043.tar.gz
gnunet-20f8436676445ff9ba5976333eea814e413c3043.zip
minor cleanup
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index 0cf6656eb..2e3523a8e 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -950,7 +950,7 @@ neighbour_keepalive_task (void *cls,
950 n->keepalive_task = 950 n->keepalive_task =
951 GNUNET_SCHEDULER_add_delayed (KEEPALIVE_FREQUENCY, 951 GNUNET_SCHEDULER_add_delayed (KEEPALIVE_FREQUENCY,
952 &neighbour_keepalive_task, n); 952 &neighbour_keepalive_task, n);
953 GNUNET_assert (is_connected (n)); 953 GNUNET_assert (S_CONNECTED == n->state);
954 GNUNET_STATISTICS_update (GST_stats, gettext_noop ("# keepalives sent"), 1, 954 GNUNET_STATISTICS_update (GST_stats, gettext_noop ("# keepalives sent"), 1,
955 GNUNET_NO); 955 GNUNET_NO);
956 m.size = htons (sizeof (struct GNUNET_MessageHeader)); 956 m.size = htons (sizeof (struct GNUNET_MessageHeader));
@@ -979,7 +979,7 @@ disconnect_all_neighbours (void *cls, const GNUNET_HashCode * key, void *value)
979 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting peer `%4s', %s\n", 979 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting peer `%4s', %s\n",
980 GNUNET_i2s (&n->id), "SHUTDOWN_TASK"); 980 GNUNET_i2s (&n->id), "SHUTDOWN_TASK");
981#endif 981#endif
982 if (is_connected (n)) 982 if (S_CONNECTED == n->state)
983 GNUNET_STATISTICS_update (GST_stats, 983 GNUNET_STATISTICS_update (GST_stats,
984 gettext_noop 984 gettext_noop
985 ("# peers disconnected due to global disconnect"), 985 ("# peers disconnected due to global disconnect"),
@@ -1209,7 +1209,7 @@ GST_neighbours_switch_to_address_3way (const struct GNUNET_PeerIdentity *peer,
1209 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1209 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1210 "ATS tells us to switch to address '%s' session %p for %s peer `%s'\n", 1210 "ATS tells us to switch to address '%s' session %p for %s peer `%s'\n",
1211 GST_plugins_a2s (address), 1211 GST_plugins_a2s (address),
1212 session, (is_connected (n) ? "CONNECTED" : "NOT CONNECTED"), 1212 session, (S_CONNECTED == n->state) ? "CONNECTED" : "NOT CONNECTED",
1213 GNUNET_i2s (peer)); 1213 GNUNET_i2s (peer));
1214#endif 1214#endif
1215 if (n->ats_suggest != GNUNET_SCHEDULER_NO_TASK) 1215 if (n->ats_suggest != GNUNET_SCHEDULER_NO_TASK)
@@ -1417,7 +1417,7 @@ GST_neighbours_try_connect (const struct GNUNET_PeerIdentity *target)
1417 1417
1418 if (NULL != n) 1418 if (NULL != n)
1419 { 1419 {
1420 if ((is_connected (n)) || (is_connecting (n))) 1420 if ((S_CONNECTED == n->state) || (is_connecting (n)))
1421 return; /* already connecting or connected */ 1421 return; /* already connecting or connected */
1422 if (is_disconnecting (n)) 1422 if (is_disconnecting (n))
1423 change_state (n, S_NOT_CONNECTED); 1423 change_state (n, S_NOT_CONNECTED);
@@ -1454,7 +1454,7 @@ GST_neighbours_test_connected (const struct GNUNET_PeerIdentity *target)
1454 1454
1455 n = lookup_neighbour (target); 1455 n = lookup_neighbour (target);
1456 1456
1457 if ((NULL == n) || (!is_connected (n))) 1457 if ((NULL == n) || (S_CONNECTED != n->state))
1458 return GNUNET_NO; /* not connected */ 1458 return GNUNET_NO; /* not connected */
1459 return GNUNET_YES; 1459 return GNUNET_YES;
1460} 1460}
@@ -1497,7 +1497,7 @@ GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer,
1497 } 1497 }
1498 1498
1499 /* not connected anymore anyway, shouldn't matter */ 1499 /* not connected anymore anyway, shouldn't matter */
1500 if ((!is_connected (n)) && (!is_connecting (n))) 1500 if ((S_CONNECTED != n->state) && (!is_connecting (n)))
1501 return; 1501 return;
1502 1502
1503 /* We are connected, so ask ATS to switch addresses */ 1503 /* We are connected, so ask ATS to switch addresses */
@@ -2086,7 +2086,7 @@ GST_neighbours_handle_ack (const struct GNUNET_MessageHeader *message,
2086 GNUNET_break (0); 2086 GNUNET_break (0);
2087 return; 2087 return;
2088 } 2088 }
2089 if (is_connected (n)) 2089 if (S_CONNECTED == n->state)
2090 return; 2090 return;
2091 if (!is_connecting(n)) 2091 if (!is_connecting(n))
2092 { 2092 {
@@ -2246,14 +2246,12 @@ GST_neighbours_handle_connect (const struct GNUNET_MessageHeader *message,
2246 GNUNET_break_op (ntohl (scm->reserved) == 0); 2246 GNUNET_break_op (ntohl (scm->reserved) == 0);
2247 2247
2248 n = lookup_neighbour (peer); 2248 n = lookup_neighbour (peer);
2249 if (n != NULL) 2249 if ( (n != NULL) &&
2250 (S_CONNECTED == n->state) )
2250 { 2251 {
2251 /* connected peer switches addresses */ 2252 /* connected peer switches addresses */
2252 if (is_connected (n)) 2253 GNUNET_ATS_address_update (GST_ats, address, session, ats, ats_count);
2253 { 2254 return;
2254 GNUNET_ATS_address_update (GST_ats, address, session, ats, ats_count);
2255 return;
2256 }
2257 } 2255 }
2258 2256
2259 /* we are not connected to this peer */ 2257 /* we are not connected to this peer */