[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r16428 - gnunet/src/transport
From: |
gnunet |
Subject: |
[GNUnet-SVN] r16428 - gnunet/src/transport |
Date: |
Sun, 7 Aug 2011 16:29:39 +0200 |
Author: grothoff
Date: 2011-08-07 16:29:39 +0200 (Sun, 07 Aug 2011)
New Revision: 16428
Modified:
gnunet/src/transport/gnunet-service-transport_neighbours.c
gnunet/src/transport/gnunet-service-transport_validation.c
Log:
stuff
Modified: gnunet/src/transport/gnunet-service-transport_neighbours.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_neighbours.c 2011-08-07
14:22:17 UTC (rev 16427)
+++ gnunet/src/transport/gnunet-service-transport_neighbours.c 2011-08-07
14:29:39 UTC (rev 16428)
@@ -321,8 +321,12 @@
{
struct MessageQueue *mq;
- disconnect_notify_cb (callback_cls,
- &n->id);
+ if (n->is_connected)
+ {
+ disconnect_notify_cb (callback_cls,
+ &n->id);
+ n->is_connected = GNUNET_NO;
+ }
GNUNET_assert (GNUNET_YES ==
GNUNET_CONTAINER_multihashmap_remove (neighbours,
&n->id.hashPubKey,
@@ -667,6 +671,23 @@
/**
+ * Peer has been idle for too long. Disconnect.
+ *
+ * @param cls the 'struct NeighbourMapEntry' of the neighbour that went idle
+ * @param tc scheduler context
+ */
+static void
+neighbour_idle_timeout_task (void *cls,
+ const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+ struct NeighbourMapEntry *n = cls;
+
+ n->timeout_task = GNUNET_SCHEDULER_NO_TASK;
+ disconnect_neighbour (n);
+}
+
+
+/**
* We have received a CONNECT. Set the peer to connected.
*
* @param sender peer sending the PONG
@@ -697,7 +718,7 @@
{
GNUNET_break (0);
return GNUNET_SYSERR;
- }
+ }
n = lookup_neighbour (sender);
if ( (NULL != n) ||
(n->is_connected == GNUNET_YES) )
@@ -745,7 +766,13 @@
// FIXME: ATS: switch session!?
// n->session = session;
}
- n->is_connected = GNUNET_YES;
+ n->peer_timeout = GNUNET_TIME_relative_to_absolute
(GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
+ if (GNUNET_SCHEDULER_NO_TASK != n->timeout_task)
+ GNUNET_SCHEDULER_cancel (n->timeout_task);
+ n->timeout_task = GNUNET_SCHEDULER_add_delayed
(GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
+ &neighbour_idle_timeout_task,
+ n);
+ n->is_connected = GNUNET_YES;
connect_notify_cb (callback_cls,
sender,
n->ats,
Modified: gnunet/src/transport/gnunet-service-transport_validation.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_validation.c 2011-08-07
14:22:17 UTC (rev 16427)
+++ gnunet/src/transport/gnunet-service-transport_validation.c 2011-08-07
14:29:39 UTC (rev 16428)
@@ -32,6 +32,7 @@
#include "gnunet_peerinfo_service.h"
#include "gnunet_signatures.h"
+// TODO: send our HELLO with the PING!
/**
* How long is a PONG signature valid? We'll recycle a signature until
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r16428 - gnunet/src/transport,
gnunet <=