aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2013-06-26 10:58:54 +0000
committerFlorian Dold <florian.dold@gmail.com>2013-06-26 10:58:54 +0000
commitae4ab9e6ce8d7529bec34bef3d7db62c393dd918 (patch)
tree69b1dae47ed91f478525549cf4af8b19cfc6c78e /src
parente1ed86ccacfda74f5575ac209091bf8476483ba4 (diff)
downloadgnunet-ae4ab9e6ce8d7529bec34bef3d7db62c393dd918.tar.gz
gnunet-ae4ab9e6ce8d7529bec34bef3d7db62c393dd918.zip
fixed duplicate tunnel creation
Diffstat (limited to 'src')
-rw-r--r--src/set/gnunet-service-set.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/set/gnunet-service-set.c b/src/set/gnunet-service-set.c
index a85093bcd..5a4a18f15 100644
--- a/src/set/gnunet-service-set.c
+++ b/src/set/gnunet-service-set.c
@@ -73,6 +73,12 @@ struct Incoming
73 * after the timeout, it will be disconnected. 73 * after the timeout, it will be disconnected.
74 */ 74 */
75 GNUNET_SCHEDULER_TaskIdentifier timeout_task; 75 GNUNET_SCHEDULER_TaskIdentifier timeout_task;
76
77 /**
78 * Tunnel context, needs to be stored here as a client's accept will change
79 * the tunnel context.
80 */
81 struct TunnelContext *tc;
76}; 82};
77 83
78 84
@@ -704,9 +710,8 @@ handle_client_accept (void *cls,
704 struct Set *set; 710 struct Set *set;
705 struct Incoming *incoming; 711 struct Incoming *incoming;
706 struct GNUNET_SET_AcceptRejectMessage *msg = (struct GNUNET_SET_AcceptRejectMessage *) mh; 712 struct GNUNET_SET_AcceptRejectMessage *msg = (struct GNUNET_SET_AcceptRejectMessage *) mh;
707 struct GNUNET_MESH_Tunnel *tunnel;
708 struct TunnelContext *tc;
709 struct OperationSpecification *spec; 713 struct OperationSpecification *spec;
714 struct TunnelContext *tc;
710 715
711 incoming = get_incoming (ntohl (msg->accept_reject_id)); 716 incoming = get_incoming (ntohl (msg->accept_reject_id));
712 717
@@ -729,10 +734,8 @@ handle_client_accept (void *cls,
729 return; 734 return;
730 } 735 }
731 736
732 tc = GNUNET_new (struct TunnelContext);
733 tunnel = GNUNET_MESH_tunnel_create (mesh, tc, &incoming->spec->peer,
734 GNUNET_APPLICATION_TYPE_SET);
735 spec = GNUNET_new (struct OperationSpecification); 737 spec = GNUNET_new (struct OperationSpecification);
738 tc = incoming->tc;
736 739
737 switch (set->operation) 740 switch (set->operation)
738 { 741 {
@@ -742,15 +745,15 @@ handle_client_accept (void *cls,
742 break; 745 break;
743 case GNUNET_SET_OPERATION_UNION: 746 case GNUNET_SET_OPERATION_UNION:
744 tc->type = CONTEXT_OPERATION_UNION; 747 tc->type = CONTEXT_OPERATION_UNION;
745 tc->data.union_op = _GSS_union_accept (spec, tunnel); 748 tc->data.union_op = _GSS_union_accept (spec, incoming->tunnel);
746 break; 749 break;
747 default: 750 default:
748 GNUNET_assert (0); 751 GNUNET_assert (0);
749 break; 752 break;
750 } 753 }
751 754
752 /* note: _GSS_*_accept has to make sure the tunnel and mq are set to NULL, 755 /* tunnel ownership goes to operation */
753 * otherwise they will be destroyed and disconnected */ 756 incoming->tunnel = NULL;
754 incoming_destroy (incoming); 757 incoming_destroy (incoming);
755 GNUNET_SERVER_receive_done (client, GNUNET_OK); 758 GNUNET_SERVER_receive_done (client, GNUNET_OK);
756} 759}
@@ -834,6 +837,7 @@ tunnel_new_cb (void *cls,
834 incoming = GNUNET_new (struct Incoming); 837 incoming = GNUNET_new (struct Incoming);
835 incoming->peer = *initiator; 838 incoming->peer = *initiator;
836 incoming->tunnel = tunnel; 839 incoming->tunnel = tunnel;
840 incoming->tc = tc;
837 tc->data.incoming = incoming; 841 tc->data.incoming = incoming;
838 tc->type = CONTEXT_INCOMING; 842 tc->type = CONTEXT_INCOMING;
839 incoming->timeout_task = 843 incoming->timeout_task =