projects
/
oweals
/
gnunet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
189e703
)
use non-constant ports for CADET with scalarproduct
author
Christian Grothoff
<christian@grothoff.org>
Wed, 10 Aug 2016 11:46:22 +0000
(11:46 +0000)
committer
Christian Grothoff
<christian@grothoff.org>
Wed, 10 Aug 2016 11:46:22 +0000
(11:46 +0000)
src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c
patch
|
blob
|
history
src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
patch
|
blob
|
history
src/scalarproduct/gnunet-service-scalarproduct_alice.c
patch
|
blob
|
history
src/scalarproduct/gnunet-service-scalarproduct_bob.c
patch
|
blob
|
history
src/scalarproduct/scalarproduct.conf.in
patch
|
blob
|
history
diff --git
a/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c
b/src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c
index 43a25a08d4e6b738c3ca2672f908f357617289a7..fe27067e86c0ccce1ab3728eed7d274aabc4074d 100644
(file)
--- a/
src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c
+++ b/
src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c
@@
-850,7
+850,11
@@
client_request_complete_alice (struct AliceServiceSession *s)
{
struct EccServiceRequestMessage *msg;
struct GNUNET_MQ_Envelope *e;
{
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));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Creating new channel for session with key %s.\n",
GNUNET_h2s (&s->session_id));
@@
-858,7
+862,7
@@
client_request_complete_alice (struct AliceServiceSession *s)
= GNUNET_CADET_channel_create (my_cadet,
s,
&s->peer,
= 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)
{
GNUNET_CADET_OPTION_RELIABLE);
if (NULL == s->channel)
{
@@
-870,7
+874,7
@@
client_request_complete_alice (struct AliceServiceSession *s)
s->intersection_listen
= GNUNET_SET_listen (cfg,
GNUNET_SET_OPERATION_INTERSECTION,
s->intersection_listen
= GNUNET_SET_listen (cfg,
GNUNET_SET_OPERATION_INTERSECTION,
- &s
->session_
id,
+ &s
et_s
id,
&cb_intersection_request_alice,
s);
if (NULL == s->intersection_listen)
&cb_intersection_request_alice,
s);
if (NULL == s->intersection_listen)
diff --git
a/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
b/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
index 7246fa6a034284548f3d6dbf975821dd4865dcd4..db656d39b23b1c2d594174660f0277ff6ab7895a 100644
(file)
--- a/
src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
+++ b/
src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
@@
-103,6
+103,11
@@
struct BobServiceSession
*/
struct GNUNET_SET_OperationHandle *intersection_op;
*/
struct GNUNET_SET_OperationHandle *intersection_op;
+ /**
+ * Our open port.
+ */
+ struct GNUNET_CADET_Port *port;
+
/**
* b(Bob)
*/
/**
* b(Bob)
*/
@@
-362,6
+367,7
@@
destroy_service_session (struct BobServiceSession *s)
gcry_mpi_point_release (s->prod_h_i_b_i);
s->prod_h_i_b_i = NULL;
}
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);
}
GNUNET_free (s);
}
@@
-795,6
+801,11
@@
cb_intersection_element_removed (void *cls,
static void
start_intersection (struct BobServiceSession *s)
{
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),
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
@@
start_intersection (struct BobServiceSession *s)
s->intersection_op
= GNUNET_SET_prepare (&s->cadet->peer,
s->intersection_op
= GNUNET_SET_prepare (&s->cadet->peer,
- &s
->session_
id,
+ &s
et_s
id,
NULL,
GNUNET_SET_RESULT_REMOVED,
&cb_intersection_element_removed,
NULL,
GNUNET_SET_RESULT_REMOVED,
&cb_intersection_element_removed,
@@
-1076,6
+1087,18
@@
GSS_handle_bob_client_message (void *cls,
s->total = total_count;
s->client_received_element_count = contained_count;
s->session_id = msg->session_key;
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,
GNUNET_break (GNUNET_YES ==
GNUNET_CONTAINER_multihashmap_put (client_sessions,
&s->session_id,
@@
-1246,9
+1269,6
@@
run (void *cls,
GNUNET_SCHEDULER_shutdown ();
return;
}
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);
}
GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
NULL);
}
diff --git
a/src/scalarproduct/gnunet-service-scalarproduct_alice.c
b/src/scalarproduct/gnunet-service-scalarproduct_alice.c
index 8c3b1ed24f7121ca5f5c6f80107c2367cc958c2b..0df7da00c16ecc0aa711b9b212be4d1aa9b1c539 100644
(file)
--- a/
src/scalarproduct/gnunet-service-scalarproduct_alice.c
+++ b/
src/scalarproduct/gnunet-service-scalarproduct_alice.c
@@
-1081,7
+1081,7
@@
client_request_complete_alice (struct AliceServiceSession *s)
= GNUNET_CADET_channel_create (my_cadet,
s,
&s->peer,
= 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)
{
GNUNET_CADET_OPTION_RELIABLE);
if (NULL == s->channel)
{
diff --git
a/src/scalarproduct/gnunet-service-scalarproduct_bob.c
b/src/scalarproduct/gnunet-service-scalarproduct_bob.c
index 84c831c82dcd4d9370455de70fcb416eb1687a53..1136f1e001b375ebdcd3a7ac2ad57ddaf9494347 100644
(file)
--- a/
src/scalarproduct/gnunet-service-scalarproduct_bob.c
+++ b/
src/scalarproduct/gnunet-service-scalarproduct_bob.c
@@
-1,6
+1,6
@@
/*
This file is part of GNUnet.
/*
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
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
@@
-103,6
+103,11
@@
struct BobServiceSession
*/
struct GNUNET_SET_OperationHandle *intersection_op;
*/
struct GNUNET_SET_OperationHandle *intersection_op;
+ /**
+ * CADET port we are listening on.
+ */
+ struct GNUNET_CADET_Port *port;
+
/**
* a(Alice)
*/
/**
* a(Alice)
*/
@@
-403,6
+408,7
@@
destroy_service_session (struct BobServiceSession *s)
GNUNET_free (s->r_prime);
s->r_prime = NULL;
}
GNUNET_free (s->r_prime);
s->r_prime = NULL;
}
+ GNUNET_CADET_close_port (s->port);
GNUNET_free (s);
}
GNUNET_free (s);
}
@@
-1176,7
+1182,7
@@
handle_alices_computation_request (void *cls,
* preliminary initialization, more happens after we get Alice's first
* message.
*
* 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
* @param channel new handle to the channel
* @param initiator peer that started the channel
* @param port unused
@@
-1357,13
+1363,6
@@
GSS_handle_bob_client_message (void *cls,
GNUNET_SYSERR);
return;
}
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;
s = GNUNET_new (struct BobServiceSession);
s->status = GNUNET_SCALARPRODUCT_STATUS_ACTIVE;
@@
-1372,6
+1371,19
@@
GSS_handle_bob_client_message (void *cls,
s->total = total_count;
s->client_received_element_count = contained_count;
s->session_id = msg->session_key;
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,
GNUNET_break (GNUNET_YES ==
GNUNET_CONTAINER_multihashmap_put (client_sessions,
&s->session_id,
@@
-1543,9
+1555,6
@@
run (void *cls,
GNUNET_SCHEDULER_shutdown ();
return;
}
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);
}
GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
NULL);
}
diff --git
a/src/scalarproduct/scalarproduct.conf.in
b/src/scalarproduct/scalarproduct.conf.in
index c5149eeaf8f60e7757569d725a85235f4534a219..e2a0c7ad7dee033fd2419834bd6faef4a11c6320 100644
(file)
--- a/
src/scalarproduct/scalarproduct.conf.in
+++ b/
src/scalarproduct/scalarproduct.conf.in
@@
-1,6
+1,6
@@
[scalarproduct-alice]
AUTOSTART = @AUTOSTART@
[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;
UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-scalarproduct-alice.sock
@UNIXONLY@ PORT = 2117
#ACCEPT_FROM = 127.0.0.1;
@@
-14,7
+14,7
@@
UNIX_MATCH_GID = YES
[scalarproduct-bob]
AUTOSTART = @AUTOSTART@
HOSTNAME = localhost
[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
UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-scalarproduct-bob.sock
@UNIXONLY@ PORT = 2118