diff options
author | Christian Fuchs <christian.fuchs@cfuchs.net> | 2014-05-12 15:44:04 +0000 |
---|---|---|
committer | Christian Fuchs <christian.fuchs@cfuchs.net> | 2014-05-12 15:44:04 +0000 |
commit | a9670db6f78bdc4be16dc856a02fe42f4e039f93 (patch) | |
tree | 36d15444e0a8f06d63c27d7e9c7b684698a51bda /src/scalarproduct | |
parent | fbfdc8a66888a992517ee61bfb9c39784b2cee83 (diff) | |
download | gnunet-a9670db6f78bdc4be16dc856a02fe42f4e039f93.tar.gz gnunet-a9670db6f78bdc4be16dc856a02fe42f4e039f93.zip |
- removed some optional parts from the SP test config
- fixed two bugs in the API, where the API would only append number-of-elements bytes instead of the size of those elements
- SP-service now retains the configuration handle received during initialization
Diffstat (limited to 'src/scalarproduct')
-rw-r--r-- | src/scalarproduct/gnunet-service-scalarproduct.c | 6 | ||||
-rw-r--r-- | src/scalarproduct/scalarproduct_api.c | 6 | ||||
-rw-r--r-- | src/scalarproduct/test_scalarproduct.conf | 97 |
3 files changed, 24 insertions, 85 deletions
diff --git a/src/scalarproduct/gnunet-service-scalarproduct.c b/src/scalarproduct/gnunet-service-scalarproduct.c index 14711bf0c..abf6daa03 100644 --- a/src/scalarproduct/gnunet-service-scalarproduct.c +++ b/src/scalarproduct/gnunet-service-scalarproduct.c | |||
@@ -2423,6 +2423,8 @@ run (void *cls, | |||
2423 | GNUNET_APPLICATION_TYPE_SCALARPRODUCT, | 2423 | GNUNET_APPLICATION_TYPE_SCALARPRODUCT, |
2424 | 0 | 2424 | 0 |
2425 | }; | 2425 | }; |
2426 | cfg = c; | ||
2427 | |||
2426 | //generate private/public key set | 2428 | //generate private/public key set |
2427 | GNUNET_CRYPTO_paillier_create (&my_pubkey, &my_privkey); | 2429 | GNUNET_CRYPTO_paillier_create (&my_pubkey, &my_privkey); |
2428 | 2430 | ||
@@ -2438,9 +2440,9 @@ run (void *cls, | |||
2438 | &cb_client_disconnect, | 2440 | &cb_client_disconnect, |
2439 | NULL); | 2441 | NULL); |
2440 | GNUNET_break (GNUNET_OK == | 2442 | GNUNET_break (GNUNET_OK == |
2441 | GNUNET_CRYPTO_get_peer_identity (c, | 2443 | GNUNET_CRYPTO_get_peer_identity (cfg, |
2442 | &me)); | 2444 | &me)); |
2443 | my_cadet = GNUNET_CADET_connect (c, NULL, | 2445 | my_cadet = GNUNET_CADET_connect (cfg, NULL, |
2444 | &cb_channel_incoming, | 2446 | &cb_channel_incoming, |
2445 | &cb_channel_destruction, | 2447 | &cb_channel_destruction, |
2446 | cadet_handlers, ports); | 2448 | cadet_handlers, ports); |
diff --git a/src/scalarproduct/scalarproduct_api.c b/src/scalarproduct/scalarproduct_api.c index 9c497129a..3b92af579 100644 --- a/src/scalarproduct/scalarproduct_api.c +++ b/src/scalarproduct/scalarproduct_api.c | |||
@@ -273,7 +273,7 @@ send_multipart (void * cls, const struct GNUNET_SCHEDULER_TaskContext * tc) | |||
273 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_SCALARPRODUCT_CLIENT_MUTLIPART); | 273 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_SCALARPRODUCT_CLIENT_MUTLIPART); |
274 | msg->element_count_contained = htonl (todo); | 274 | msg->element_count_contained = htonl (todo); |
275 | 275 | ||
276 | memcpy (&msg[1], &h->elements[h->element_count_transfered], todo); | 276 | memcpy (&msg[1], &h->elements[h->element_count_transfered], todo * sizeof (struct GNUNET_SCALARPRODUCT_Element)); |
277 | h->element_count_transfered += todo; | 277 | h->element_count_transfered += todo; |
278 | 278 | ||
279 | h->th = GNUNET_CLIENT_notify_transmit_ready (h->client, size, | 279 | h->th = GNUNET_CLIENT_notify_transmit_ready (h->client, size, |
@@ -515,7 +515,7 @@ GNUNET_SCALARPRODUCT_start_computation (const struct GNUNET_CONFIGURATION_Handle | |||
515 | size = sizeof (struct GNUNET_SCALARPRODUCT_computation_message) + possible*sizeof (struct GNUNET_SCALARPRODUCT_Element); | 515 | size = sizeof (struct GNUNET_SCALARPRODUCT_computation_message) + possible*sizeof (struct GNUNET_SCALARPRODUCT_Element); |
516 | h->elements = (struct GNUNET_SCALARPRODUCT_Element*) | 516 | h->elements = (struct GNUNET_SCALARPRODUCT_Element*) |
517 | GNUNET_malloc (sizeof(struct GNUNET_SCALARPRODUCT_Element) * element_count); | 517 | GNUNET_malloc (sizeof(struct GNUNET_SCALARPRODUCT_Element) * element_count); |
518 | memcpy (h->elements, elements, sizeof (struct GNUNET_SCALARPRODUCT_Element)*element_count); | 518 | memcpy (h->elements, elements, sizeof (struct GNUNET_SCALARPRODUCT_Element) * element_count); |
519 | } | 519 | } |
520 | 520 | ||
521 | h->cont_datum = cont; | 521 | h->cont_datum = cont; |
@@ -533,7 +533,7 @@ GNUNET_SCALARPRODUCT_start_computation (const struct GNUNET_CONFIGURATION_Handle | |||
533 | 533 | ||
534 | memcpy (&msg->peer, peer, sizeof (struct GNUNET_PeerIdentity)); | 534 | memcpy (&msg->peer, peer, sizeof (struct GNUNET_PeerIdentity)); |
535 | memcpy (&msg->session_key, session_key, sizeof (struct GNUNET_HashCode)); | 535 | memcpy (&msg->session_key, session_key, sizeof (struct GNUNET_HashCode)); |
536 | memcpy (&msg[1], elements, possible); | 536 | memcpy (&msg[1], elements, sizeof (struct GNUNET_SCALARPRODUCT_Element) * possible); |
537 | 537 | ||
538 | h->th = GNUNET_CLIENT_notify_transmit_ready (h->client, size, | 538 | h->th = GNUNET_CLIENT_notify_transmit_ready (h->client, size, |
539 | GNUNET_TIME_UNIT_FOREVER_REL, | 539 | GNUNET_TIME_UNIT_FOREVER_REL, |
diff --git a/src/scalarproduct/test_scalarproduct.conf b/src/scalarproduct/test_scalarproduct.conf index e80b9dc0e..fb9a34da6 100644 --- a/src/scalarproduct/test_scalarproduct.conf +++ b/src/scalarproduct/test_scalarproduct.conf | |||
@@ -1,94 +1,31 @@ | |||
1 | [arm] | 1 | [arm] |
2 | DEFAULTSERVICES = core cadet statistics scalarproduct | 2 | DEFAULTSERVICES = core cadet statistics scalarproduct set |
3 | PORT = 12366 | 3 | PORT = 12366 |
4 | 4 | ||
5 | [ats] | ||
6 | WAN_QUOTA_OUT = 3932160 | ||
7 | WAN_QUOTA_IN = 3932160 | ||
8 | |||
9 | [block] | ||
10 | plugins = dht test | ||
11 | |||
12 | [consensus] | ||
13 | AUTOSTART = NO | ||
14 | |||
15 | [core] | ||
16 | PORT = 12092 | ||
17 | AUTOSTART = YES | ||
18 | |||
19 | [dht] | ||
20 | AUTOSTART = YES | ||
21 | DISABLE_TRY_CONNECT = NO | ||
22 | |||
23 | [dhtcache] | ||
24 | QUOTA = 1 MB | ||
25 | DATABASE = heap | ||
26 | |||
27 | [dns] | ||
28 | AUTOSTART = NO | ||
29 | |||
30 | [fs] | ||
31 | AUTOSTART = NO | ||
32 | |||
33 | [gnunetd] | ||
34 | HOSTKEY = $SERVICEHOME/.hostkey | ||
35 | |||
36 | [cadet] | ||
37 | #AUTOSTART = YES | ||
38 | ACCEPT_FROM = 127.0.0.1; | ||
39 | PORT = 10700 | ||
40 | |||
41 | [nat] | ||
42 | RETURN_LOCAL_ADDRESSES = YES | ||
43 | |||
44 | [namestore] | ||
45 | AUTOSTART = NO | ||
46 | |||
47 | [nse] | ||
48 | AUTOSTART = NO | ||
49 | |||
50 | [PATHS] | 5 | [PATHS] |
51 | GNUNET_TEST_HOME = /tmp/test-scalarproduct/ | 6 | GNUNET_TEST_HOME = /tmp/test-scalarproduct/ |
52 | 7 | ||
53 | [psycstore] | ||
54 | AUTOSTART = NO | ||
55 | |||
56 | [regex] | ||
57 | AUTOSTART = NO | ||
58 | |||
59 | [resolver] | ||
60 | AUTOSTART = NO | ||
61 | HOSTNAME = localhost | ||
62 | |||
63 | [statistics] | ||
64 | AUTOSTART = NO | ||
65 | |||
66 | [scalarproduct] | 8 | [scalarproduct] |
67 | AUTOSTART = YES | 9 | AUTOSTART = YES |
68 | BINARY = gnunet-service-scalarproduct | 10 | BINARY = gnunet-service-scalarproduct |
69 | UNIXPATH = $SERVICEHOME/scalarproduct.sock | 11 | #UNIXPATH = $SERVICEHOME/scalarproduct.sock |
70 | #HOME = $SERVICEHOME | 12 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-scalarproduct.sock |
71 | HOSTNAME = localhost | 13 | HOSTNAME = localhost |
72 | PORT = 13087 | 14 | PORT = 13087 |
15 | #OPTIONS = -L DEBUG | ||
73 | 16 | ||
74 | [transport] | 17 | [set] |
75 | PLUGINS = tcp | 18 | AUTOSTART = YES |
76 | ACCEPT_FROM6 = ::1; | 19 | PORT = 12106 |
77 | ACCEPT_FROM = 127.0.0.1; | 20 | HOSTNAME = localhost |
78 | NEIGHBOUR_LIMIT = 50 | 21 | BINARY = gnunet-service-set |
79 | PORT = 12365 | 22 | #ACCEPT_FROM = 127.0.0.1; |
80 | 23 | #ACCEPT_FROM6 = ::1; | |
81 | [transport-tcp] | 24 | #UNIXPATH = $SERVICEHOME/set.sock |
82 | TIMEOUT = 300 s | 25 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-set.sock |
83 | PORT = 12368 | 26 | #UNIX_MATCH_UID = YES |
27 | #UNIX_MATCH_GID = YES | ||
28 | #OPTIONS = -L DEBUG | ||
84 | 29 | ||
85 | [testbed] | 30 | [testbed] |
86 | OVERLAY_TOPOLOGY = LINE | 31 | OVERLAY_TOPOLOGY = CLIQUE \ No newline at end of file |
87 | |||
88 | [TESTING] | ||
89 | WEAKRANDOM = YES | ||
90 | |||
91 | [vpn] | ||
92 | AUTOSTART = NO | ||
93 | |||
94 | |||