{
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_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)
{
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)
*/
struct GNUNET_SET_OperationHandle *intersection_op;
+ /**
+ * Our open port.
+ */
+ struct GNUNET_CADET_Port *port;
+
/**
* b(Bob)
*/
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);
}
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),
s->intersection_op
= GNUNET_SET_prepare (&s->cadet->peer,
- &s->session_id,
+ &set_sid,
NULL,
GNUNET_SET_RESULT_REMOVED,
&cb_intersection_element_removed,
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_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_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)
{
/*
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
*/
struct GNUNET_SET_OperationHandle *intersection_op;
+ /**
+ * CADET port we are listening on.
+ */
+ struct GNUNET_CADET_Port *port;
+
/**
* a(Alice)
*/
GNUNET_free (s->r_prime);
s->r_prime = NULL;
}
+ GNUNET_CADET_close_port (s->port);
GNUNET_free (s);
}
* 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
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->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_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);
}
[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;
[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