aboutsummaryrefslogtreecommitdiff
path: root/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-08-10 11:46:22 +0000
committerChristian Grothoff <christian@grothoff.org>2016-08-10 11:46:22 +0000
commit6d5959b29aa3ff47605aa91550d90fc28597d0de (patch)
treea1a6b2815d0f8ff1ab145196283d8b31097cb045 /src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
parent189e703a007d7950842e71399526a3b11ef5a6ac (diff)
downloadgnunet-6d5959b29aa3ff47605aa91550d90fc28597d0de.tar.gz
gnunet-6d5959b29aa3ff47605aa91550d90fc28597d0de.zip
use non-constant ports for CADET with scalarproduct
Diffstat (limited to 'src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c')
-rw-r--r--src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c b/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
index 7246fa6a0..db656d39b 100644
--- a/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
+++ b/src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
@@ -104,6 +104,11 @@ struct BobServiceSession
104 struct GNUNET_SET_OperationHandle *intersection_op; 104 struct GNUNET_SET_OperationHandle *intersection_op;
105 105
106 /** 106 /**
107 * Our open port.
108 */
109 struct GNUNET_CADET_Port *port;
110
111 /**
107 * b(Bob) 112 * b(Bob)
108 */ 113 */
109 struct MpiElement *sorted_elements; 114 struct MpiElement *sorted_elements;
@@ -362,6 +367,7 @@ destroy_service_session (struct BobServiceSession *s)
362 gcry_mpi_point_release (s->prod_h_i_b_i); 367 gcry_mpi_point_release (s->prod_h_i_b_i);
363 s->prod_h_i_b_i = NULL; 368 s->prod_h_i_b_i = NULL;
364 } 369 }
370 GNUNET_CADET_close_port (s->port);
365 GNUNET_free (s); 371 GNUNET_free (s);
366} 372}
367 373
@@ -795,6 +801,11 @@ cb_intersection_element_removed (void *cls,
795static void 801static void
796start_intersection (struct BobServiceSession *s) 802start_intersection (struct BobServiceSession *s)
797{ 803{
804 struct GNUNET_HashCode set_sid;
805
806 GNUNET_CRYPTO_hash (&s->session_id,
807 sizeof (struct GNUNET_HashCode),
808 &set_sid);
798 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 809 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
799 "Got session with key %s and %u elements, starting intersection.\n", 810 "Got session with key %s and %u elements, starting intersection.\n",
800 GNUNET_h2s (&s->session_id), 811 GNUNET_h2s (&s->session_id),
@@ -802,7 +813,7 @@ start_intersection (struct BobServiceSession *s)
802 813
803 s->intersection_op 814 s->intersection_op
804 = GNUNET_SET_prepare (&s->cadet->peer, 815 = GNUNET_SET_prepare (&s->cadet->peer,
805 &s->session_id, 816 &set_sid,
806 NULL, 817 NULL,
807 GNUNET_SET_RESULT_REMOVED, 818 GNUNET_SET_RESULT_REMOVED,
808 &cb_intersection_element_removed, 819 &cb_intersection_element_removed,
@@ -1076,6 +1087,18 @@ GSS_handle_bob_client_message (void *cls,
1076 s->total = total_count; 1087 s->total = total_count;
1077 s->client_received_element_count = contained_count; 1088 s->client_received_element_count = contained_count;
1078 s->session_id = msg->session_key; 1089 s->session_id = msg->session_key;
1090 s->port = GNUNET_CADET_open_port (my_cadet,
1091 &msg->session_key,
1092 &cb_channel_incoming,
1093 s);
1094 if (NULL == s->port)
1095 {
1096 GNUNET_break (0);
1097 GNUNET_SERVER_receive_done (client,
1098 GNUNET_SYSERR);
1099 GNUNET_free (s);
1100 return;
1101 }
1079 GNUNET_break (GNUNET_YES == 1102 GNUNET_break (GNUNET_YES ==
1080 GNUNET_CONTAINER_multihashmap_put (client_sessions, 1103 GNUNET_CONTAINER_multihashmap_put (client_sessions,
1081 &s->session_id, 1104 &s->session_id,
@@ -1246,9 +1269,6 @@ run (void *cls,
1246 GNUNET_SCHEDULER_shutdown (); 1269 GNUNET_SCHEDULER_shutdown ();
1247 return; 1270 return;
1248 } 1271 }
1249 GNUNET_CADET_open_port (my_cadet,
1250 GC_u2h (GNUNET_APPLICATION_TYPE_SCALARPRODUCT_ECC),
1251 &cb_channel_incoming, NULL);
1252 GNUNET_SCHEDULER_add_shutdown (&shutdown_task, 1272 GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
1253 NULL); 1273 NULL);
1254} 1274}