gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] branch master updated: introduce loose state, fix


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated: introduce loose state, fix channel state machine
Date: Thu, 16 Feb 2017 22:11:04 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new fe2f5348f introduce loose state, fix channel state machine
fe2f5348f is described below

commit fe2f5348fd84240ad682692a68f333c44f358515
Author: Christian Grothoff <address@hidden>
AuthorDate: Thu Feb 16 22:08:55 2017 +0100

    introduce loose state, fix channel state machine
---
 src/cadet/gnunet-service-cadet-new_channel.c | 28 ++++++++++++++++++++++++----
 1 file changed, 24 insertions(+), 4 deletions(-)

diff --git a/src/cadet/gnunet-service-cadet-new_channel.c 
b/src/cadet/gnunet-service-cadet-new_channel.c
index 9d9edc28d..68220fe67 100644
--- a/src/cadet/gnunet-service-cadet-new_channel.c
+++ b/src/cadet/gnunet-service-cadet-new_channel.c
@@ -76,7 +76,7 @@
 
 
 /**
- * All the states a connection can be in.
+ * All the states a channel can be in.
  */
 enum CadetChannelState
 {
@@ -86,7 +86,13 @@ enum CadetChannelState
   CADET_CHANNEL_NEW,
 
   /**
-   * Connection create message sent, waiting for ACK.
+   * Channel is to a port that is not open, we're waiting for the
+   * port to be opened.
+   */
+  CADET_CHANNEL_LOOSE,
+
+  /**
+   * CHANNEL_OPEN message sent, waiting for CHANNEL_OPEN_ACK.
    */
   CADET_CHANNEL_OPEN_SENT,
 
@@ -644,6 +650,7 @@ GCCH_channel_local_new (struct CadetClient *owner,
     if (NULL == c)
     {
       /* port closed, wait for it to possibly open */
+      ch->state = CADET_CHANNEL_LOOSE;
       (void) GNUNET_CONTAINER_multihashmap_put (loose_channels,
                                                 port,
                                                 ch,
@@ -740,6 +747,7 @@ GCCH_channel_incoming_new (struct CadetTunnel *t,
   if (NULL == c)
   {
     /* port closed, wait for it to possibly open */
+    ch->state = CADET_CHANNEL_LOOSE;
     (void) GNUNET_CONTAINER_multihashmap_put (loose_channels,
                                               port,
                                               ch,
@@ -977,6 +985,7 @@ GCCH_bind (struct CadetChannel *ch,
   else
   {
     /* notify other peer that we accepted the connection */
+    ch->state = CADET_CHANNEL_READY;
     ch->retry_control_task
       = GNUNET_SCHEDULER_add_now (&send_open_ack,
                                   ch);
@@ -1044,12 +1053,19 @@ GCCH_channel_local_destroy (struct CadetChannel *ch,
     return;
   }
   /* If the we ever sent the CHANNEL_CREATE, we need to send a destroy 
message. */
-  if (CADET_CHANNEL_NEW == ch->state)
+  switch (ch->state)
+  {
+  case CADET_CHANNEL_NEW:
+    GNUNET_break (0);
+    break;
+  case CADET_CHANNEL_LOOSE:
     GSC_drop_loose_channel (&ch->port,
                             ch);
-  else
+    break;
+  default:
     GCT_send_channel_destroy (ch->t,
                               ch->ctn);
+  }
   /* Nothing left to do, just finish destruction */
   channel_destroy (ch);
 }
@@ -1072,6 +1088,10 @@ GCCH_handle_channel_open_ack (struct CadetChannel *ch,
     /* this should be impossible */
     GNUNET_break (0);
     break;
+  case CADET_CHANNEL_LOOSE:
+    /* This makes no sense. */
+    GNUNET_break_op (0);
+    break;
   case CADET_CHANNEL_OPEN_SENT:
     if (NULL == ch->owner)
     {

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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