aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-transport_neighbours.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2014-03-28 14:55:42 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2014-03-28 14:55:42 +0000
commit6142516fdf010fd5aa0d13f773bf5edf3b1eae22 (patch)
tree23903da3903d5b6440ca3ed0f43b9cd980685c5c /src/transport/gnunet-service-transport_neighbours.c
parentc4245a9d06bbefac2638c009fd48287a22ed05e4 (diff)
downloadgnunet-6142516fdf010fd5aa0d13f773bf5edf3b1eae22.tar.gz
gnunet-6142516fdf010fd5aa0d13f773bf5edf3b1eae22.zip
changes in ACK handling
Diffstat (limited to 'src/transport/gnunet-service-transport_neighbours.c')
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index f1305ba0d..2b3d96a55 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -692,7 +692,7 @@ set_timeout (struct NeighbourMapEntry *n,
692 struct GNUNET_TIME_Absolute timeout) 692 struct GNUNET_TIME_Absolute timeout)
693{ 693{
694 n->timeout = timeout; 694 n->timeout = timeout;
695 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Neighbour `%s' changed timeout %s\n", 695 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Neighbour `%s' changed timeout %s\n",
696 GNUNET_i2s (&n->id), 696 GNUNET_i2s (&n->id),
697 GNUNET_STRINGS_absolute_time_to_string (timeout)); 697 GNUNET_STRINGS_absolute_time_to_string (timeout));
698 neighbour_change_cb (callback_cls, 698 neighbour_change_cb (callback_cls,
@@ -2455,7 +2455,7 @@ switch_address_bl_check_cont (void *cls,
2455 } 2455 }
2456 2456
2457 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 2457 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
2458 "Blacklist accepted to switch to suggested address `%s' session %p for peer `%s'\n", 2458 "Blacklist accepted address `%s' session %p for peer `%s'\n",
2459 GST_plugins_a2s (blc_ctx->address), 2459 GST_plugins_a2s (blc_ctx->address),
2460 blc_ctx->session, 2460 blc_ctx->session,
2461 GNUNET_i2s (&blc_ctx->address->peer)); 2461 GNUNET_i2s (&blc_ctx->address->peer));
@@ -2696,7 +2696,7 @@ GST_neighbours_switch_to_address (const struct GNUNET_PeerIdentity *peer,
2696 } 2696 }
2697 2697
2698 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 2698 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
2699 "ATS tells us to switch to %s address '%s' session %p for " 2699 "ATS suggests %s address '%s' session %p for "
2700 "peer `%s' in state %s/%s (quota in/out %u %u )\n", 2700 "peer `%s' in state %s/%s (quota in/out %u %u )\n",
2701 GNUNET_HELLO_address_check_option (address, 2701 GNUNET_HELLO_address_check_option (address,
2702 GNUNET_HELLO_ADDRESS_INFO_INBOUND) ? "inbound" : "outbound", 2702 GNUNET_HELLO_ADDRESS_INFO_INBOUND) ? "inbound" : "outbound",
@@ -3143,7 +3143,7 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message,
3143 1, GNUNET_NO); 3143 1, GNUNET_NO);
3144 break; 3144 break;
3145 case GNUNET_TRANSPORT_PS_CONNECTED: 3145 case GNUNET_TRANSPORT_PS_CONNECTED:
3146 /* duplicate CONNECT_ACK, let's answer by duplciate SESSION_ACK just in case */ 3146 /* duplicate CONNECT_ACK, let's answer by duplicate SESSION_ACK just in case */
3147 send_session_ack_message (n); 3147 send_session_ack_message (n);
3148 break; 3148 break;
3149 case GNUNET_TRANSPORT_PS_RECONNECT_ATS: 3149 case GNUNET_TRANSPORT_PS_RECONNECT_ATS:
@@ -3373,22 +3373,26 @@ GST_neighbours_handle_session_ack (const struct GNUNET_MessageHeader *message,
3373 GNUNET_break_op (0); 3373 GNUNET_break_op (0);
3374 return GNUNET_SYSERR; 3374 return GNUNET_SYSERR;
3375 } 3375 }
3376 /* check if we are in a plausible state for having sent 3376 /* Check if we are in a plausible state for having sent
3377 a CONNECT_ACK. If not, return, otherwise break */ 3377 a CONNECT_ACK. If not, return, otherwise break.
3378 3378
3379 /* TODO I have no idea we we should state GNUNET_TRANSPORT_PS_CONNECT_SENT 3379 The remote peers sends a SESSION_ACK as a response for a CONNECT_ACK
3380 * Perhaps SWITCHING? Have to check */ 3380 message.
3381 if ( (GNUNET_TRANSPORT_PS_CONNECT_RECV_ACK != n->state) /*&& 3381
3382 (GNUNET_TRANSPORT_PS_RECONNECT_SENT != n->state) ) || 3382 We expect a SESSION_ACK:
3383 (ACK_SEND_SESSION_ACK != n->ack_state)*/) 3383 - If a remote peer has sent a CONNECT, we responded with a CONNECT_ACK and
3384 { 3384 now wait for the ACK to finally be connected
3385 GNUNET_break (0); /* TESTING */ 3385 - If we sent a CONNECT_ACK to this peer before */
3386 3386
3387 if ( (GNUNET_TRANSPORT_PS_CONNECT_RECV_ACK != n->state) ||
3388 (ACK_SEND_SESSION_ACK != n->ack_state))
3389 {
3387 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 3390 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
3388 "Received unexpected SESSION_ACK message from peer `%s' in state %s/%s\n", 3391 "Received unexpected SESSION_ACK message from peer `%s' in state %s/%s\n",
3389 GNUNET_i2s (peer), 3392 GNUNET_i2s (peer),
3390 GNUNET_TRANSPORT_ps2s (n->state), 3393 GNUNET_TRANSPORT_ps2s (n->state),
3391 print_ack_state (n->ack_state)); 3394 print_ack_state (n->ack_state));
3395
3392 GNUNET_STATISTICS_update (GST_stats, 3396 GNUNET_STATISTICS_update (GST_stats,
3393 gettext_noop ("# unexpected SESSION_ACK messages"), 1, 3397 gettext_noop ("# unexpected SESSION_ACK messages"), 1,
3394 GNUNET_NO); 3398 GNUNET_NO);