n->quota_violation_count--;
}
}
- GNUNET_SCHEDULER_cancel (n->timeout_task);
- n->timeout_task =
- GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
- &neighbour_timeout_task, n);
if (n->quota_violation_count > QUOTA_VIOLATION_DROP_THRESHOLD)
{
GNUNET_STATISTICS_update (GST_stats,
}
+/**
+ * Keep the connection to the given neighbour alive longer,
+ * we received a KEEPALIVE (or equivalent).
+ *
+ * @param neighbour neighbour to keep alive
+ */
+void
+GST_neighbours_keepalive (const struct GNUNET_PeerIdentity *neighbour)
+{
+ struct NeighbourMapEntry *n;
+
+ n = lookup_neighbour (neighbour);
+ if (NULL == n)
+ {
+ GNUNET_STATISTICS_update (GST_stats,
+ gettext_noop ("# KEEPALIVE messages discarded (not connected)"),
+ 1,
+ GNUNET_NO);
+ return;
+ }
+ GNUNET_SCHEDULER_cancel (n->timeout_task);
+ n->timeout_task =
+ GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
+ &neighbour_timeout_task, n);
+}
+
+
/**
* Change the incoming quota for the given peer.
*
struct GNUNET_CRYPTO_RsaSignature signature;
/**
- * What are we signing and why? Two possible reason codes can be here:
* GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_OWN to confirm that this is a
- * plausible address for this peer (pid is set to identity of signer); or
- * GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_USING to confirm that this is
- * an address we used to connect to the peer with the given pid.
+ * plausible address for the signing peer.
*/
struct GNUNET_CRYPTO_RsaSignaturePurpose purpose;
*/
struct GNUNET_TIME_AbsoluteNBO expiration;
- /**
- * Either the identity of the peer Who signed this message, or the
- * identity of the peer that we're connected to using the given
- * address (depending on purpose.type).
- */
- struct GNUNET_PeerIdentity pid;
-
/**
* Size of address appended to this message (part of what is
* being signed, hence not redundant).
htonl (sizeof (struct GNUNET_CRYPTO_RsaSignaturePurpose) +
sizeof (uint32_t) +
sizeof (struct GNUNET_TIME_AbsoluteNBO) +
- sizeof (struct GNUNET_PeerIdentity) + alen + slen);
+ alen + slen);
pong->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_OWN);
pong->challenge = ping->challenge;
pong->addrlen = htonl(alen + slen);
- pong->pid = GST_my_identity;
memcpy (&pong[1], addr, slen);
memcpy (&((char*)&pong[1])[slen], addrend, alen);
if (GNUNET_TIME_absolute_get_remaining (*sig_cache_exp).rel_value < PONG_SIGNATURE_LIFETIME.rel_value / 4)
1,
GNUNET_NO);
pong = (const struct TransportPongMessage *) hdr;
- if (0 != memcmp (&pong->pid,
- sender,
- sizeof (struct GNUNET_PeerIdentity)))
- {
- GNUNET_break_op (0);
- return;
- }
addr = (const char*) &pong[1];
alen = ntohs (hdr->size) - sizeof (struct TransportPongMessage);
addrend = memchr (addr, '\0', alen);
return;
}
/* now check that PONG is well-formed */
+ if (0 != memcmp (&ve->pid,
+ sender,
+ sizeof (struct GNUNET_PeerIdentity)))
+ {
+ GNUNET_break_op (0);
+ return;
+ }
+
if (GNUNET_TIME_absolute_get_remaining (GNUNET_TIME_absolute_ntoh (pong->expiration)).rel_value == 0)
{
GNUNET_STATISTICS_update (GST_stats,