diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-08-10 11:46:22 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-08-10 11:46:22 +0000 |
commit | 6d5959b29aa3ff47605aa91550d90fc28597d0de (patch) | |
tree | a1a6b2815d0f8ff1ab145196283d8b31097cb045 /src/scalarproduct/gnunet-service-scalarproduct_bob.c | |
parent | 189e703a007d7950842e71399526a3b11ef5a6ac (diff) | |
download | gnunet-6d5959b29aa3ff47605aa91550d90fc28597d0de.tar.gz gnunet-6d5959b29aa3ff47605aa91550d90fc28597d0de.zip |
use non-constant ports for CADET with scalarproduct
Diffstat (limited to 'src/scalarproduct/gnunet-service-scalarproduct_bob.c')
-rw-r--r-- | src/scalarproduct/gnunet-service-scalarproduct_bob.c | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/src/scalarproduct/gnunet-service-scalarproduct_bob.c b/src/scalarproduct/gnunet-service-scalarproduct_bob.c index 84c831c82..1136f1e00 100644 --- a/src/scalarproduct/gnunet-service-scalarproduct_bob.c +++ b/src/scalarproduct/gnunet-service-scalarproduct_bob.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2013, 2014 GNUnet e.V. | 3 | Copyright (C) 2013, 2014, 2016 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -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 | * CADET port we are listening on. | ||
108 | */ | ||
109 | struct GNUNET_CADET_Port *port; | ||
110 | |||
111 | /** | ||
107 | * a(Alice) | 112 | * a(Alice) |
108 | */ | 113 | */ |
109 | struct MpiElement *sorted_elements; | 114 | struct MpiElement *sorted_elements; |
@@ -403,6 +408,7 @@ destroy_service_session (struct BobServiceSession *s) | |||
403 | GNUNET_free (s->r_prime); | 408 | GNUNET_free (s->r_prime); |
404 | s->r_prime = NULL; | 409 | s->r_prime = NULL; |
405 | } | 410 | } |
411 | GNUNET_CADET_close_port (s->port); | ||
406 | GNUNET_free (s); | 412 | GNUNET_free (s); |
407 | } | 413 | } |
408 | 414 | ||
@@ -1176,7 +1182,7 @@ handle_alices_computation_request (void *cls, | |||
1176 | * preliminary initialization, more happens after we get Alice's first | 1182 | * preliminary initialization, more happens after we get Alice's first |
1177 | * message. | 1183 | * message. |
1178 | * | 1184 | * |
1179 | * @param cls closure | 1185 | * @param cls closure with the `struct BobServiceSession` |
1180 | * @param channel new handle to the channel | 1186 | * @param channel new handle to the channel |
1181 | * @param initiator peer that started the channel | 1187 | * @param initiator peer that started the channel |
1182 | * @param port unused | 1188 | * @param port unused |
@@ -1357,13 +1363,6 @@ GSS_handle_bob_client_message (void *cls, | |||
1357 | GNUNET_SYSERR); | 1363 | GNUNET_SYSERR); |
1358 | return; | 1364 | return; |
1359 | } | 1365 | } |
1360 | if (NULL != find_matching_client_session (&msg->session_key)) | ||
1361 | { | ||
1362 | GNUNET_break (0); | ||
1363 | GNUNET_SERVER_receive_done (client, | ||
1364 | GNUNET_SYSERR); | ||
1365 | return; | ||
1366 | } | ||
1367 | 1366 | ||
1368 | s = GNUNET_new (struct BobServiceSession); | 1367 | s = GNUNET_new (struct BobServiceSession); |
1369 | s->status = GNUNET_SCALARPRODUCT_STATUS_ACTIVE; | 1368 | s->status = GNUNET_SCALARPRODUCT_STATUS_ACTIVE; |
@@ -1372,6 +1371,19 @@ GSS_handle_bob_client_message (void *cls, | |||
1372 | s->total = total_count; | 1371 | s->total = total_count; |
1373 | s->client_received_element_count = contained_count; | 1372 | s->client_received_element_count = contained_count; |
1374 | s->session_id = msg->session_key; | 1373 | s->session_id = msg->session_key; |
1374 | s->port = GNUNET_CADET_open_port (my_cadet, | ||
1375 | &msg->session_key, | ||
1376 | &cb_channel_incoming, | ||
1377 | s); | ||
1378 | if (NULL == s->port) | ||
1379 | { | ||
1380 | GNUNET_break (0); | ||
1381 | GNUNET_SERVER_receive_done (client, | ||
1382 | GNUNET_SYSERR); | ||
1383 | GNUNET_free (s); | ||
1384 | return; | ||
1385 | } | ||
1386 | |||
1375 | GNUNET_break (GNUNET_YES == | 1387 | GNUNET_break (GNUNET_YES == |
1376 | GNUNET_CONTAINER_multihashmap_put (client_sessions, | 1388 | GNUNET_CONTAINER_multihashmap_put (client_sessions, |
1377 | &s->session_id, | 1389 | &s->session_id, |
@@ -1543,9 +1555,6 @@ run (void *cls, | |||
1543 | GNUNET_SCHEDULER_shutdown (); | 1555 | GNUNET_SCHEDULER_shutdown (); |
1544 | return; | 1556 | return; |
1545 | } | 1557 | } |
1546 | GNUNET_CADET_open_port (my_cadet, | ||
1547 | GC_u2h (GNUNET_APPLICATION_TYPE_SCALARPRODUCT), | ||
1548 | &cb_channel_incoming, NULL); | ||
1549 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, | 1558 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, |
1550 | NULL); | 1559 | NULL); |
1551 | } | 1560 | } |