[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r26089 - gnunet/src/core
From: |
gnunet |
Subject: |
[GNUnet-SVN] r26089 - gnunet/src/core |
Date: |
Wed, 13 Feb 2013 11:46:26 +0100 |
Author: grothoff
Date: 2013-02-13 11:46:26 +0100 (Wed, 13 Feb 2013)
New Revision: 26089
Modified:
gnunet/src/core/gnunet-service-core_kx.c
gnunet/src/core/gnunet-service-core_sessions.c
Log:
-trying to fix #2794
Modified: gnunet/src/core/gnunet-service-core_kx.c
===================================================================
--- gnunet/src/core/gnunet-service-core_kx.c 2013-02-13 10:45:53 UTC (rev
26088)
+++ gnunet/src/core/gnunet-service-core_kx.c 2013-02-13 10:46:26 UTC (rev
26089)
@@ -270,8 +270,11 @@
KX_STATE_UP,
/**
- * We're rekeying, so we have sent the other peer our new ephemeral
- * key, but we did not get a matching PONG yet.
+ * We're rekeying (or had a timeout), so we have sent the other peer
+ * our new ephemeral key, but we did not get a matching PONG yet.
+ * This is equivalent to being 'KX_STATE_KEY_RECEIVED', except that
+ * the session is marked as 'up' with sessions (as we don't want to
+ * drop and re-establish P2P connections simply due to rekeying).
*/
KX_STATE_REKEY_SENT
@@ -1222,6 +1225,11 @@
const struct GNUNET_ATS_Information *atsi;
/**
+ * Key exchange context.
+ */
+ struct GSC_KeyExchangeInfo *kx;
+
+ /**
* Sender of the message.
*/
const struct GNUNET_PeerIdentity *peer;
@@ -1276,11 +1284,11 @@
}
if (0 == GNUNET_TIME_absolute_get_remaining
(kx->foreign_key_expires).rel_value)
{
- kx->status = KX_STATE_KEY_SENT;
GNUNET_STATISTICS_update (GSC_stats,
- gettext_noop
- ("# DATA message dropped (session key expired)"),
+ gettext_noop ("# sessions terminated by key
expiration"),
1, GNUNET_NO);
+ GSC_SESSIONS_end (&kx->peer);
+ kx->status = KX_STATE_KEY_SENT;
send_key (kx);
return;
}
@@ -1379,6 +1387,7 @@
gettext_noop ("# bytes of payload decrypted"),
size - sizeof (struct EncryptedMessage),
GNUNET_NO);
dmc.atsi = atsi;
+ dmc.kx = kx;
dmc.atsi_count = atsi_count;
dmc.peer = &kx->peer;
if (GNUNET_OK !=
@@ -1404,6 +1413,14 @@
{
struct DeliverMessageContext *dmc = client;
+ if (KX_STATE_UP != dmc->kx->status)
+ {
+ GNUNET_STATISTICS_update (GSC_stats,
+ gettext_noop
+ ("# PAYLOAD dropped (out of order)"),
+ 1, GNUNET_NO);
+ return GNUNET_OK;
+ }
switch (ntohs (m->type))
{
case GNUNET_MESSAGE_TYPE_CORE_BINARY_TYPE_MAP:
Modified: gnunet/src/core/gnunet-service-core_sessions.c
===================================================================
--- gnunet/src/core/gnunet-service-core_sessions.c 2013-02-13 10:45:53 UTC
(rev 26088)
+++ gnunet/src/core/gnunet-service-core_sessions.c 2013-02-13 10:46:26 UTC
(rev 26089)
@@ -115,13 +115,6 @@
struct GSC_TypeMap *tmap;
/**
- * At what time did we initially establish this session?
- * (currently unused, should be integrated with ATS in the
- * future...).
- */
- struct GNUNET_TIME_Absolute time_established;
-
- /**
* Task to transmit corked messages with a delay.
*/
GNUNET_SCHEDULER_TaskIdentifier cork_task;
@@ -137,6 +130,12 @@
*/
int ready_to_transmit;
+ /**
+ * Is this the first time we're sending the typemap? If so,
+ * we want to send it a bit faster the second time. 0 if
+ * we are sending for the first time, 1 if not.
+ */
+ int first_typemap;
};
@@ -226,7 +225,15 @@
struct GNUNET_MessageHeader *hdr;
struct GNUNET_TIME_Relative delay;
- delay = TYPEMAP_FREQUENCY;
+ if (0 == session->first_typemap)
+ {
+ delay = GNUNET_TIME_UNIT_ZERO;
+ session->first_typemap = 1;
+ }
+ else
+ {
+ delay = TYPEMAP_FREQUENCY;
+ }
/* randomize a bit to avoid spont. sync */
delay.rel_value +=
GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 1000);
@@ -259,7 +266,6 @@
session->tmap = GSC_TYPEMAP_create ();
session->peer = *peer;
session->kxinfo = kx;
- session->time_established = GNUNET_TIME_absolute_get ();
session->typemap_task =
GNUNET_SCHEDULER_add_now (&transmit_typemap_task, session);
GNUNET_assert (GNUNET_OK ==
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r26089 - gnunet/src/core,
gnunet <=