aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-05-13 19:17:29 +0000
committerChristian Grothoff <christian@grothoff.org>2012-05-13 19:17:29 +0000
commitd6e57643a0abcdcd6e7aee0ca587e56105b402c2 (patch)
tree65d7fc0bc6d62fa12b37cd6367ebfb4f73abddb8
parent7ab9567f3e7c8351685edeed8fe424a7219a25c5 (diff)
downloadgnunet-d6e57643a0abcdcd6e7aee0ca587e56105b402c2.tar.gz
gnunet-d6e57643a0abcdcd6e7aee0ca587e56105b402c2.zip
-fixing #2347
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index faccf3695..3778c704d 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -890,6 +890,19 @@ send_with_session (struct NeighbourMapEntry *n,
890 890
891 891
892/** 892/**
893 * Master task run for every neighbour. Performs all of the time-related
894 * activities (keep alive, send next message, disconnect if idle, finish
895 * clean up after disconnect).
896 *
897 * @param cls the 'struct NeighbourMapEntry' for which we are running
898 * @param tc scheduler context (unused)
899 */
900static void
901master_task (void *cls,
902 const struct GNUNET_SCHEDULER_TaskContext *tc);
903
904
905/**
893 * Function called when the 'DISCONNECT' message has been sent by the 906 * Function called when the 'DISCONNECT' message has been sent by the
894 * plugin. Frees the neighbour --- if the entry still exists. 907 * plugin. Frees the neighbour --- if the entry still exists.
895 * 908 *
@@ -908,8 +921,9 @@ send_disconnect_cont (void *cls, const struct GNUNET_PeerIdentity *target,
908 return; /* already gone */ 921 return; /* already gone */
909 if (S_DISCONNECT != n->state) 922 if (S_DISCONNECT != n->state)
910 return; /* have created a fresh entry since */ 923 return; /* have created a fresh entry since */
911 n->state = S_DISCONNECT_FINISHED; 924 n->state = S_DISCONNECT;
912 free_neighbour (n); 925 GNUNET_SCHEDULER_cancel (n->task);
926 n->task = GNUNET_SCHEDULER_add_now (&master_task, n);
913} 927}
914 928
915 929
@@ -956,19 +970,6 @@ send_disconnect (struct NeighbourMapEntry *n)
956 970
957 971
958/** 972/**
959 * Master task run for every neighbour. Performs all of the time-related
960 * activities (keep alive, send next message, disconnect if idle, finish
961 * clean up after disconnect).
962 *
963 * @param cls the 'struct NeighbourMapEntry' for which we are running
964 * @param tc scheduler context (unused)
965 */
966static void
967master_task (void *cls,
968 const struct GNUNET_SCHEDULER_TaskContext *tc);
969
970
971/**
972 * Disconnect from the given neighbour, clean up the record. 973 * Disconnect from the given neighbour, clean up the record.
973 * 974 *
974 * @param n neighbour to disconnect from 975 * @param n neighbour to disconnect from
@@ -2425,6 +2426,8 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message,
2425 1, GNUNET_NO); 2426 1, GNUNET_NO);
2426 break; 2427 break;
2427 case S_CONNECT_SENT: 2428 case S_CONNECT_SENT:
2429 if (ts.abs_value != n->primary_address.connect_timestamp.abs_value)
2430 break; /* ACK does not match our original CONNECT message */
2428 n->state = S_CONNECTED; 2431 n->state = S_CONNECTED;
2429 n->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); 2432 n->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
2430 GNUNET_STATISTICS_set (GST_stats, 2433 GNUNET_STATISTICS_set (GST_stats,