[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r37684 - gnunet/src/scalarproduct
From: |
gnunet |
Subject: |
[GNUnet-SVN] r37684 - gnunet/src/scalarproduct |
Date: |
Wed, 10 Aug 2016 13:46:23 +0200 |
Author: grothoff
Date: 2016-08-10 13:46:22 +0200 (Wed, 10 Aug 2016)
New Revision: 37684
Modified:
gnunet/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c
gnunet/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
gnunet/src/scalarproduct/gnunet-service-scalarproduct_alice.c
gnunet/src/scalarproduct/gnunet-service-scalarproduct_bob.c
gnunet/src/scalarproduct/scalarproduct.conf.in
Log:
use non-constant ports for CADET with scalarproduct
Modified: gnunet/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c
===================================================================
--- gnunet/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c
2016-08-09 23:22:03 UTC (rev 37683)
+++ gnunet/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c
2016-08-10 11:46:22 UTC (rev 37684)
@@ -850,7 +850,11 @@
{
struct EccServiceRequestMessage *msg;
struct GNUNET_MQ_Envelope *e;
+ struct GNUNET_HashCode set_sid;
+ GNUNET_CRYPTO_hash (&s->session_id,
+ sizeof (struct GNUNET_HashCode),
+ &set_sid);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Creating new channel for session with key %s.\n",
GNUNET_h2s (&s->session_id));
@@ -858,7 +862,7 @@
= GNUNET_CADET_channel_create (my_cadet,
s,
&s->peer,
- GC_u2h
(GNUNET_APPLICATION_TYPE_SCALARPRODUCT_ECC),
+ &s->session_id,
GNUNET_CADET_OPTION_RELIABLE);
if (NULL == s->channel)
{
@@ -870,7 +874,7 @@
s->intersection_listen
= GNUNET_SET_listen (cfg,
GNUNET_SET_OPERATION_INTERSECTION,
- &s->session_id,
+ &set_sid,
&cb_intersection_request_alice,
s);
if (NULL == s->intersection_listen)
Modified: gnunet/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
===================================================================
--- gnunet/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
2016-08-09 23:22:03 UTC (rev 37683)
+++ gnunet/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
2016-08-10 11:46:22 UTC (rev 37684)
@@ -104,6 +104,11 @@
struct GNUNET_SET_OperationHandle *intersection_op;
/**
+ * Our open port.
+ */
+ struct GNUNET_CADET_Port *port;
+
+ /**
* b(Bob)
*/
struct MpiElement *sorted_elements;
@@ -362,6 +367,7 @@
gcry_mpi_point_release (s->prod_h_i_b_i);
s->prod_h_i_b_i = NULL;
}
+ GNUNET_CADET_close_port (s->port);
GNUNET_free (s);
}
@@ -795,6 +801,11 @@
static void
start_intersection (struct BobServiceSession *s)
{
+ struct GNUNET_HashCode set_sid;
+
+ GNUNET_CRYPTO_hash (&s->session_id,
+ sizeof (struct GNUNET_HashCode),
+ &set_sid);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Got session with key %s and %u elements, starting
intersection.\n",
GNUNET_h2s (&s->session_id),
@@ -802,7 +813,7 @@
s->intersection_op
= GNUNET_SET_prepare (&s->cadet->peer,
- &s->session_id,
+ &set_sid,
NULL,
GNUNET_SET_RESULT_REMOVED,
&cb_intersection_element_removed,
@@ -1076,6 +1087,18 @@
s->total = total_count;
s->client_received_element_count = contained_count;
s->session_id = msg->session_key;
+ s->port = GNUNET_CADET_open_port (my_cadet,
+ &msg->session_key,
+ &cb_channel_incoming,
+ s);
+ if (NULL == s->port)
+ {
+ GNUNET_break (0);
+ GNUNET_SERVER_receive_done (client,
+ GNUNET_SYSERR);
+ GNUNET_free (s);
+ return;
+ }
GNUNET_break (GNUNET_YES ==
GNUNET_CONTAINER_multihashmap_put (client_sessions,
&s->session_id,
@@ -1246,9 +1269,6 @@
GNUNET_SCHEDULER_shutdown ();
return;
}
- GNUNET_CADET_open_port (my_cadet,
- GC_u2h (GNUNET_APPLICATION_TYPE_SCALARPRODUCT_ECC),
- &cb_channel_incoming, NULL);
GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
NULL);
}
Modified: gnunet/src/scalarproduct/gnunet-service-scalarproduct_alice.c
===================================================================
--- gnunet/src/scalarproduct/gnunet-service-scalarproduct_alice.c
2016-08-09 23:22:03 UTC (rev 37683)
+++ gnunet/src/scalarproduct/gnunet-service-scalarproduct_alice.c
2016-08-10 11:46:22 UTC (rev 37684)
@@ -1081,7 +1081,7 @@
= GNUNET_CADET_channel_create (my_cadet,
s,
&s->peer,
- GC_u2h
(GNUNET_APPLICATION_TYPE_SCALARPRODUCT),
+ &s->session_id,
GNUNET_CADET_OPTION_RELIABLE);
if (NULL == s->channel)
{
Modified: gnunet/src/scalarproduct/gnunet-service-scalarproduct_bob.c
===================================================================
--- gnunet/src/scalarproduct/gnunet-service-scalarproduct_bob.c 2016-08-09
23:22:03 UTC (rev 37683)
+++ gnunet/src/scalarproduct/gnunet-service-scalarproduct_bob.c 2016-08-10
11:46:22 UTC (rev 37684)
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- Copyright (C) 2013, 2014 GNUnet e.V.
+ Copyright (C) 2013, 2014, 2016 GNUnet e.V.
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
@@ -104,6 +104,11 @@
struct GNUNET_SET_OperationHandle *intersection_op;
/**
+ * CADET port we are listening on.
+ */
+ struct GNUNET_CADET_Port *port;
+
+ /**
* a(Alice)
*/
struct MpiElement *sorted_elements;
@@ -403,6 +408,7 @@
GNUNET_free (s->r_prime);
s->r_prime = NULL;
}
+ GNUNET_CADET_close_port (s->port);
GNUNET_free (s);
}
@@ -1176,7 +1182,7 @@
* preliminary initialization, more happens after we get Alice's first
* message.
*
- * @param cls closure
+ * @param cls closure with the `struct BobServiceSession`
* @param channel new handle to the channel
* @param initiator peer that started the channel
* @param port unused
@@ -1357,13 +1363,6 @@
GNUNET_SYSERR);
return;
}
- if (NULL != find_matching_client_session (&msg->session_key))
- {
- GNUNET_break (0);
- GNUNET_SERVER_receive_done (client,
- GNUNET_SYSERR);
- return;
- }
s = GNUNET_new (struct BobServiceSession);
s->status = GNUNET_SCALARPRODUCT_STATUS_ACTIVE;
@@ -1372,6 +1371,19 @@
s->total = total_count;
s->client_received_element_count = contained_count;
s->session_id = msg->session_key;
+ s->port = GNUNET_CADET_open_port (my_cadet,
+ &msg->session_key,
+ &cb_channel_incoming,
+ s);
+ if (NULL == s->port)
+ {
+ GNUNET_break (0);
+ GNUNET_SERVER_receive_done (client,
+ GNUNET_SYSERR);
+ GNUNET_free (s);
+ return;
+ }
+
GNUNET_break (GNUNET_YES ==
GNUNET_CONTAINER_multihashmap_put (client_sessions,
&s->session_id,
@@ -1543,9 +1555,6 @@
GNUNET_SCHEDULER_shutdown ();
return;
}
- GNUNET_CADET_open_port (my_cadet,
- GC_u2h (GNUNET_APPLICATION_TYPE_SCALARPRODUCT),
- &cb_channel_incoming, NULL);
GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
NULL);
}
Modified: gnunet/src/scalarproduct/scalarproduct.conf.in
===================================================================
--- gnunet/src/scalarproduct/scalarproduct.conf.in 2016-08-09 23:22:03 UTC
(rev 37683)
+++ gnunet/src/scalarproduct/scalarproduct.conf.in 2016-08-10 11:46:22 UTC
(rev 37684)
@@ -1,6 +1,6 @@
[scalarproduct-alice]
AUTOSTART = @AUTOSTART@
-BINARY = gnunet-service-scalarproduct-alice
+BINARY = gnunet-service-scalarproduct-ecc-alice
UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-scalarproduct-alice.sock
@UNIXONLY@ PORT = 2117
#ACCEPT_FROM = 127.0.0.1;
@@ -14,7 +14,7 @@
[scalarproduct-bob]
AUTOSTART = @AUTOSTART@
HOSTNAME = localhost
-BINARY = gnunet-service-scalarproduct-bob
+BINARY = gnunet-service-scalarproduct-ecc-bob
UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-scalarproduct-bob.sock
@UNIXONLY@ PORT = 2118
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r37684 - gnunet/src/scalarproduct,
gnunet <=