}
+/**
+ * Master task run for every neighbour. Performs all of the time-related
+ * activities (keep alive, send next message, disconnect if idle, finish
+ * clean up after disconnect).
+ *
+ * @param cls the 'struct NeighbourMapEntry' for which we are running
+ * @param tc scheduler context (unused)
+ */
+static void
+master_task (void *cls,
+ const struct GNUNET_SCHEDULER_TaskContext *tc);
+
+
/**
* Function called when the 'DISCONNECT' message has been sent by the
* plugin. Frees the neighbour --- if the entry still exists.
return; /* already gone */
if (S_DISCONNECT != n->state)
return; /* have created a fresh entry since */
- n->state = S_DISCONNECT_FINISHED;
- free_neighbour (n);
+ n->state = S_DISCONNECT;
+ GNUNET_SCHEDULER_cancel (n->task);
+ n->task = GNUNET_SCHEDULER_add_now (&master_task, n);
}
}
-/**
- * Master task run for every neighbour. Performs all of the time-related
- * activities (keep alive, send next message, disconnect if idle, finish
- * clean up after disconnect).
- *
- * @param cls the 'struct NeighbourMapEntry' for which we are running
- * @param tc scheduler context (unused)
- */
-static void
-master_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc);
-
-
/**
* Disconnect from the given neighbour, clean up the record.
*
1, GNUNET_NO);
break;
case S_CONNECT_SENT:
+ if (ts.abs_value != n->primary_address.connect_timestamp.abs_value)
+ break; /* ACK does not match our original CONNECT message */
n->state = S_CONNECTED;
n->timeout = GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
GNUNET_STATISTICS_set (GST_stats,