[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r34591 - gnunet/src/cadet
From: |
gnunet |
Subject: |
[GNUnet-SVN] r34591 - gnunet/src/cadet |
Date: |
Mon, 15 Dec 2014 08:17:55 +0100 |
Author: bartpolot
Date: 2014-12-15 08:17:55 +0100 (Mon, 15 Dec 2014)
New Revision: 34591
Modified:
gnunet/src/cadet/gnunet-service-cadet_connection.c
gnunet/src/cadet/gnunet-service-cadet_peer.c
gnunet/src/cadet/gnunet-service-cadet_tunnel.c
gnunet/src/cadet/gnunet-service-cadet_tunnel.h
Log:
Fix connection count to count only ESTABLISHED connections, use DEFINE instead
of hardcoded number
Modified: gnunet/src/cadet/gnunet-service-cadet_connection.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_connection.c 2014-12-15 07:17:53 UTC
(rev 34590)
+++ gnunet/src/cadet/gnunet-service-cadet_connection.c 2014-12-15 07:17:55 UTC
(rev 34591)
@@ -1833,6 +1833,7 @@
}
t = c->t;
+
fwd = is_fwd (c, id);
c->destroy = GNUNET_YES;
if (GCC_is_terminal (c, fwd))
@@ -2699,7 +2700,8 @@
struct CadetFlowControl *fc;
fc = fwd ? &c->fwd_fc : &c->bck_fc;
- if (GC_is_pid_bigger (fc->last_pid_recv, fc->last_ack_sent))
+ if (CADET_CONNECTION_READY != c->state
+ || GC_is_pid_bigger (fc->last_pid_recv, fc->last_ack_sent))
{
return 0;
}
Modified: gnunet/src/cadet/gnunet-service-cadet_peer.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_peer.c 2014-12-15 07:17:53 UTC
(rev 34590)
+++ gnunet/src/cadet/gnunet-service-cadet_peer.c 2014-12-15 07:17:55 UTC
(rev 34591)
@@ -941,8 +941,8 @@
/* Count connections */
connection_count = GCT_count_connections (peer->tunnel);
- /* If we already have 3 (or more (?!)) connections, it's enough */
- if (3 <= connection_count)
+ /* If we already have our minimum (or more) connections, it's enough */
+ if (CONNECTIONS_PER_TUNNEL <= connection_count)
return;
if (CADET_TUNNEL_SEARCHING == GCT_get_cstate (peer->tunnel))
@@ -1914,11 +1914,7 @@
LOG (GNUNET_ERROR_TYPE_DEBUG, " added\n");
GNUNET_CONTAINER_DLL_insert_before (peer->path_head,
peer->path_tail, aux, path);
- if (NULL != peer->tunnel && 3 < GCT_count_connections (peer->tunnel))
- {
- GCP_connect (peer);
- }
- return path;
+ goto finish;
}
else
{
@@ -1933,7 +1929,10 @@
GNUNET_CONTAINER_DLL_insert_tail (peer->path_head, peer->path_tail,
path);
LOG (GNUNET_ERROR_TYPE_DEBUG, " added last\n");
- if (NULL != peer->tunnel && 3 < GCT_count_connections (peer->tunnel))
+
+finish:
+ if (NULL != peer->tunnel
+ && CONNECTIONS_PER_TUNNEL < GCT_count_connections (peer->tunnel))
{
GCP_connect (peer);
}
Modified: gnunet/src/cadet/gnunet-service-cadet_tunnel.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_tunnel.c 2014-12-15 07:17:53 UTC
(rev 34590)
+++ gnunet/src/cadet/gnunet-service-cadet_tunnel.c 2014-12-15 07:17:55 UTC
(rev 34591)
@@ -37,8 +37,6 @@
#define REKEY_WAIT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 5)
-#define CONNECTIONS_PER_TUNNEL 3
-
#if !defined(GNUNET_CULL_LOGGING)
#define DUMP_KEYS_TO_STDERR GNUNET_YES
#else
@@ -2332,7 +2330,7 @@
for (c = iter = t->connection_head; NULL != iter; iter = iter->next)
{
- if ((NULL == c || iter->created.abs_value_us > c->created.abs_value_us)
+ if ((iter->created.abs_value_us > c->created.abs_value_us)
&& GNUNET_NO == GCC_is_direct (iter->c))
{
c = iter;
@@ -2788,7 +2786,7 @@
return 0;
for (count = 0, iter = t->connection_head; NULL != iter; iter = iter->next)
- if (CADET_CONNECTION_DESTROYED != GCC_get_state (iter->c))
+ if (CADET_CONNECTION_READY == GCC_get_state (iter->c))
count++;
return count;
@@ -3065,24 +3063,29 @@
}
/* Authorize connections to send more data */
- to_allow = buffer; /* - allowed; */
+ to_allow = buffer; /* FIXME (- allowed;) */
for (iter = t->connection_head;
NULL != iter && to_allow > 0;
iter = iter->next)
{
+ if (CADET_CONNECTION_READY != GCC_get_state (iter->c)
+ || get_connection_allowed (iter) > 64 / 3)
+ {
+ continue;
+ }
allow_per_connection = to_allow/cs;
to_allow -= allow_per_connection;
cs--;
- if (get_connection_allowed (iter) > 64 / 3)
- {
- continue;
- }
GCC_allow (iter->c, allow_per_connection,
GCC_is_origin (iter->c, GNUNET_NO));
}
- GNUNET_break (to_allow == 0); //FIXME tripped
+ if (0 != to_allow)
+ {
+ GNUNET_break (0);
+ LOG (GNUNET_ERROR_TYPE_WARNING, " reminding to_allow: %u\n", to_allow);
+ }
}
Modified: gnunet/src/cadet/gnunet-service-cadet_tunnel.h
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_tunnel.h 2014-12-15 07:17:53 UTC
(rev 34590)
+++ gnunet/src/cadet/gnunet-service-cadet_tunnel.h 2014-12-15 07:17:55 UTC
(rev 34591)
@@ -40,6 +40,8 @@
#include "platform.h"
#include "gnunet_util_lib.h"
+#define CONNECTIONS_PER_TUNNEL 3
+
/**
* All the connectivity states a tunnel can be in.
*/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r34591 - gnunet/src/cadet,
gnunet <=