gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r27114 - gnunet/src/mesh


From: gnunet
Subject: [GNUnet-SVN] r27114 - gnunet/src/mesh
Date: Tue, 14 May 2013 12:19:05 +0200

Author: bartpolot
Date: 2013-05-14 12:19:05 +0200 (Tue, 14 May 2013)
New Revision: 27114

Modified:
   gnunet/src/mesh/gnunet-service-mesh-new.c
Log:
- refactor fc init

Modified: gnunet/src/mesh/gnunet-service-mesh-new.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh-new.c   2013-05-14 10:13:57 UTC (rev 
27113)
+++ gnunet/src/mesh/gnunet-service-mesh-new.c   2013-05-14 10:19:05 UTC (rev 
27114)
@@ -1798,13 +1798,6 @@
     return;
   }
   t->client = c;
-  t->next_fc.last_ack_sent = t->prev_fc.last_pid_recv + 1;
-  t->next_fc.last_pid_sent = t->prev_fc.last_pid_recv;
-  t->next_fc.last_ack_recv = t->nobuffer ? 1 : INITIAL_WINDOW_SIZE - 1;
-  t->next_fc.last_pid_recv = (uint32_t) -1; /* Expected next: 0 */
-  t->next_fc.poll_task = GNUNET_SCHEDULER_NO_TASK;
-  t->next_fc.poll_time = GNUNET_TIME_UNIT_SECONDS;
-  t->next_fc.queue_n = 0;
 }
 
 
@@ -2291,6 +2284,20 @@
     t->destroy = GNUNET_YES;
 }
 
+/**
+ * Initialize a Flow Control structure
+ */
+static void
+fc_init (struct MeshFlowControl *fc)
+{
+  fc->last_pid_sent = (uint32_t) -1; /* Next (expected) = 0 */
+  fc->last_pid_recv = (uint32_t) -1;
+  fc->last_ack_sent = INITIAL_WINDOW_SIZE - 1;
+  fc->last_ack_recv = INITIAL_WINDOW_SIZE - 1;
+  fc->poll_task = GNUNET_SCHEDULER_NO_TASK;
+  fc->poll_time = GNUNET_TIME_UNIT_SECONDS;
+  fc->queue_n = 0;
+}
 
 /**
  * Create a new tunnel
@@ -2319,14 +2326,8 @@
   t->id.tid = tid;
   t->queue_max = (max_msgs_queue / max_tunnels) + 1;
   t->owner = client;
-  t->next_fc.last_pid_sent = (uint32_t) -1; /* Next (expected) = 0 */
-  t->next_fc.last_pid_recv = (uint32_t) -1;
-  t->prev_fc.last_pid_sent = (uint32_t) -1;
-  t->prev_fc.last_pid_recv = (uint32_t) -1;
-  t->next_fc.last_ack_sent = INITIAL_WINDOW_SIZE - 1;
-  t->next_fc.last_ack_recv = INITIAL_WINDOW_SIZE - 1;
-  t->prev_fc.last_ack_sent = INITIAL_WINDOW_SIZE - 1;
-  t->prev_fc.last_ack_recv = INITIAL_WINDOW_SIZE - 1;
+  fc_init (&t->next_fc);
+  fc_init (&t->prev_fc);
   t->local_tid = local;
   n_tunnels++;
   GNUNET_STATISTICS_update (stats, "# tunnels", 1, GNUNET_NO);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]