gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r27619 - gnunet/src/set


From: gnunet
Subject: [GNUnet-SVN] r27619 - gnunet/src/set
Date: Wed, 26 Jun 2013 12:58:55 +0200

Author: dold
Date: 2013-06-26 12:58:54 +0200 (Wed, 26 Jun 2013)
New Revision: 27619

Modified:
   gnunet/src/set/gnunet-service-set.c
Log:
fixed duplicate tunnel creation


Modified: gnunet/src/set/gnunet-service-set.c
===================================================================
--- gnunet/src/set/gnunet-service-set.c 2013-06-26 10:47:53 UTC (rev 27618)
+++ gnunet/src/set/gnunet-service-set.c 2013-06-26 10:58:54 UTC (rev 27619)
@@ -73,6 +73,12 @@
    * after the timeout, it will be disconnected.
    */
   GNUNET_SCHEDULER_TaskIdentifier timeout_task;
+
+  /**
+   * Tunnel context, needs to be stored here as a client's accept will change
+   * the tunnel context.
+   */
+  struct TunnelContext *tc;
 };
 
 
@@ -704,9 +710,8 @@
   struct Set *set;
   struct Incoming *incoming;
   struct GNUNET_SET_AcceptRejectMessage *msg = (struct 
GNUNET_SET_AcceptRejectMessage *) mh;
-  struct GNUNET_MESH_Tunnel *tunnel;
+  struct OperationSpecification *spec;
   struct TunnelContext *tc;
-  struct OperationSpecification *spec;
 
   incoming = get_incoming (ntohl (msg->accept_reject_id));
 
@@ -729,10 +734,8 @@
     return;
   }
 
-  tc = GNUNET_new (struct TunnelContext);
-  tunnel = GNUNET_MESH_tunnel_create (mesh, tc, &incoming->spec->peer,
-                                      GNUNET_APPLICATION_TYPE_SET);
   spec = GNUNET_new (struct OperationSpecification);
+  tc = incoming->tc;
 
   switch (set->operation)
   {
@@ -742,15 +745,15 @@
       break;
     case GNUNET_SET_OPERATION_UNION:
       tc->type = CONTEXT_OPERATION_UNION;
-      tc->data.union_op = _GSS_union_accept (spec, tunnel);
+      tc->data.union_op = _GSS_union_accept (spec, incoming->tunnel);
       break;
     default:
       GNUNET_assert (0);
       break;
   }
 
-  /* note: _GSS_*_accept has to make sure the tunnel and mq are set to NULL,
-   * otherwise they will be destroyed and disconnected */
+  /* tunnel ownership goes to operation */
+  incoming->tunnel = NULL;
   incoming_destroy (incoming);
   GNUNET_SERVER_receive_done (client, GNUNET_OK);
 }
@@ -834,6 +837,7 @@
   incoming = GNUNET_new (struct Incoming);
   incoming->peer = *initiator;
   incoming->tunnel = tunnel;
+  incoming->tc = tc;
   tc->data.incoming = incoming;
   tc->type = CONTEXT_INCOMING;
   incoming->timeout_task = 




reply via email to

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