diff options
author | Christian Grothoff <christian@grothoff.org> | 2014-12-07 00:42:31 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2014-12-07 00:42:31 +0000 |
commit | d30f73b49715899b2aa12e4819a0e105994c5411 (patch) | |
tree | a1c2ff23e637053477334bddcbe4e8969c6cfc5d /src/scalarproduct | |
parent | 7b993324a717497da6d34573a45150c48ca8786f (diff) | |
download | gnunet-d30f73b49715899b2aa12e4819a0e105994c5411.tar.gz gnunet-d30f73b49715899b2aa12e4819a0e105994c5411.zip |
-fix some of the obvious issues
Diffstat (limited to 'src/scalarproduct')
-rw-r--r-- | src/scalarproduct/gnunet-service-scalarproduct_alice.c | 8 | ||||
-rw-r--r-- | src/scalarproduct/gnunet-service-scalarproduct_bob.c | 6 | ||||
-rw-r--r-- | src/scalarproduct/scalarproduct.conf.in | 13 | ||||
-rw-r--r-- | src/scalarproduct/test_scalarproduct.conf | 22 | ||||
-rwxr-xr-x | src/scalarproduct/test_scalarproduct.sh | 10 |
5 files changed, 27 insertions, 32 deletions
diff --git a/src/scalarproduct/gnunet-service-scalarproduct_alice.c b/src/scalarproduct/gnunet-service-scalarproduct_alice.c index 1cfc2a89f..b5ab8a88f 100644 --- a/src/scalarproduct/gnunet-service-scalarproduct_alice.c +++ b/src/scalarproduct/gnunet-service-scalarproduct_alice.c | |||
@@ -817,8 +817,8 @@ static int | |||
817 | element_cmp (const void *a, | 817 | element_cmp (const void *a, |
818 | const void *b) | 818 | const void *b) |
819 | { | 819 | { |
820 | const struct MpiElement *ma = *(const struct MpiElement **) a; | 820 | const struct MpiElement *ma = a; |
821 | const struct MpiElement *mb = *(const struct MpiElement **) b; | 821 | const struct MpiElement *mb = b; |
822 | 822 | ||
823 | return GNUNET_CRYPTO_hash_cmp (ma->key, | 823 | return GNUNET_CRYPTO_hash_cmp (ma->key, |
824 | mb->key); | 824 | mb->key); |
@@ -858,7 +858,7 @@ send_alices_cryptodata_message (struct AliceServiceSession *s) | |||
858 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 858 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
859 | "Finished intersection, %d items remain\n", | 859 | "Finished intersection, %d items remain\n", |
860 | s->used_element_count); | 860 | s->used_element_count); |
861 | qsort (s->intersected_elements, | 861 | qsort (s->sorted_elements, |
862 | s->used_element_count, | 862 | s->used_element_count, |
863 | sizeof (struct MpiElement), | 863 | sizeof (struct MpiElement), |
864 | &element_cmp); | 864 | &element_cmp); |
@@ -1296,6 +1296,8 @@ handle_client_disconnect (void *cls, | |||
1296 | { | 1296 | { |
1297 | struct AliceServiceSession *s; | 1297 | struct AliceServiceSession *s; |
1298 | 1298 | ||
1299 | if (NULL == client) | ||
1300 | return; | ||
1299 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1301 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1300 | "Client %p disconnected from us.\n", | 1302 | "Client %p disconnected from us.\n", |
1301 | client); | 1303 | client); |
diff --git a/src/scalarproduct/gnunet-service-scalarproduct_bob.c b/src/scalarproduct/gnunet-service-scalarproduct_bob.c index 2a452c64f..23bfcda0e 100644 --- a/src/scalarproduct/gnunet-service-scalarproduct_bob.c +++ b/src/scalarproduct/gnunet-service-scalarproduct_bob.c | |||
@@ -815,8 +815,8 @@ static int | |||
815 | element_cmp (const void *a, | 815 | element_cmp (const void *a, |
816 | const void *b) | 816 | const void *b) |
817 | { | 817 | { |
818 | const struct MpiElement *ma = *(const struct MpiElement **) a; | 818 | const struct MpiElement *ma = a; |
819 | const struct MpiElement *mb = *(const struct MpiElement **) b; | 819 | const struct MpiElement *mb = b; |
820 | 820 | ||
821 | return GNUNET_CRYPTO_hash_cmp (ma->key, | 821 | return GNUNET_CRYPTO_hash_cmp (ma->key, |
822 | mb->key); | 822 | mb->key); |
@@ -844,7 +844,7 @@ transmit_cryptographic_reply (struct BobServiceSession *s) | |||
844 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 844 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
845 | "Finished intersection, %d items remain\n", | 845 | "Finished intersection, %d items remain\n", |
846 | s->used_element_count); | 846 | s->used_element_count); |
847 | qsort (s->intersected_elements, | 847 | qsort (s->sorted_elements, |
848 | s->used_element_count, | 848 | s->used_element_count, |
849 | sizeof (struct MpiElement), | 849 | sizeof (struct MpiElement), |
850 | &element_cmp); | 850 | &element_cmp); |
diff --git a/src/scalarproduct/scalarproduct.conf.in b/src/scalarproduct/scalarproduct.conf.in index a383e37cc..558e60d04 100644 --- a/src/scalarproduct/scalarproduct.conf.in +++ b/src/scalarproduct/scalarproduct.conf.in | |||
@@ -1,10 +1,23 @@ | |||
1 | [scalarproduct-alice] | 1 | [scalarproduct-alice] |
2 | AUTOSTART = @AUTOSTART@ | ||
2 | BINARY = gnunet-service-scalarproduct-alice | 3 | BINARY = gnunet-service-scalarproduct-alice |
3 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-scalarproduct-alice.sock | 4 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-scalarproduct-alice.sock |
4 | @UNIXONLY@ PORT = 2117 | 5 | @UNIXONLY@ PORT = 2117 |
6 | #ACCEPT_FROM = 127.0.0.1; | ||
7 | #ACCEPT_FROM6 = ::1; | ||
8 | UNIX_MATCH_UID = NO | ||
9 | UNIX_MATCH_GID = YES | ||
10 | #OPTIONS = -L DEBUG | ||
5 | 11 | ||
6 | [scalarproduct-bob] | 12 | [scalarproduct-bob] |
13 | AUTOSTART = @AUTOSTART@ | ||
14 | HOSTNAME = localhost | ||
7 | BINARY = gnunet-service-scalarproduct-bob | 15 | BINARY = gnunet-service-scalarproduct-bob |
8 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-scalarproduct-bob.sock | 16 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-scalarproduct-bob.sock |
9 | @UNIXONLY@ PORT = 2118 | 17 | @UNIXONLY@ PORT = 2118 |
10 | 18 | ||
19 | #ACCEPT_FROM = 127.0.0.1; | ||
20 | #ACCEPT_FROM6 = ::1; | ||
21 | UNIX_MATCH_UID = NO | ||
22 | UNIX_MATCH_GID = YES | ||
23 | #OPTIONS = -L DEBUG \ No newline at end of file | ||
diff --git a/src/scalarproduct/test_scalarproduct.conf b/src/scalarproduct/test_scalarproduct.conf index b61197dac..36e175b16 100644 --- a/src/scalarproduct/test_scalarproduct.conf +++ b/src/scalarproduct/test_scalarproduct.conf | |||
@@ -5,27 +5,5 @@ PORT = 12366 | |||
5 | [PATHS] | 5 | [PATHS] |
6 | GNUNET_TEST_HOME = /tmp/test-scalarproduct/ | 6 | GNUNET_TEST_HOME = /tmp/test-scalarproduct/ |
7 | 7 | ||
8 | [scalarproduct] | ||
9 | AUTOSTART = YES | ||
10 | BINARY = gnunet-service-scalarproduct | ||
11 | #UNIXPATH = $SERVICEHOME/scalarproduct.sock | ||
12 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-scalarproduct.sock | ||
13 | HOSTNAME = localhost | ||
14 | PORT = 13087 | ||
15 | #OPTIONS = -L DEBUG | ||
16 | |||
17 | [set] | ||
18 | AUTOSTART = YES | ||
19 | PORT = 12106 | ||
20 | HOSTNAME = localhost | ||
21 | BINARY = gnunet-service-set | ||
22 | #ACCEPT_FROM = 127.0.0.1; | ||
23 | #ACCEPT_FROM6 = ::1; | ||
24 | #UNIXPATH = $SERVICEHOME/set.sock | ||
25 | UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-set.sock | ||
26 | #UNIX_MATCH_UID = YES | ||
27 | #UNIX_MATCH_GID = YES | ||
28 | #OPTIONS = -L DEBUG | ||
29 | |||
30 | [testbed] | 8 | [testbed] |
31 | OVERLAY_TOPOLOGY = CLIQUE \ No newline at end of file | 9 | OVERLAY_TOPOLOGY = CLIQUE \ No newline at end of file |
diff --git a/src/scalarproduct/test_scalarproduct.sh b/src/scalarproduct/test_scalarproduct.sh index eed9de30f..8a34c2473 100755 --- a/src/scalarproduct/test_scalarproduct.sh +++ b/src/scalarproduct/test_scalarproduct.sh | |||
@@ -3,6 +3,7 @@ | |||
3 | # payload for this test: | 3 | # payload for this test: |
4 | INPUTALICE="-k CCC -e 'AB,10;RO,3;FL,3;LOL,-1;'" | 4 | INPUTALICE="-k CCC -e 'AB,10;RO,3;FL,3;LOL,-1;'" |
5 | INPUTBOB="-k CCC -e 'BC,-20000;RO,1000;FL,100;LOL,24;'" | 5 | INPUTBOB="-k CCC -e 'BC,-20000;RO,1000;FL,100;LOL,24;'" |
6 | EXPECTED="0CCC" | ||
6 | 7 | ||
7 | # necessary to make the testing prefix deterministic, so we can access the config files | 8 | # necessary to make the testing prefix deterministic, so we can access the config files |
8 | PREFIX=/tmp/test-scalarproduct`date +%H%M%S` | 9 | PREFIX=/tmp/test-scalarproduct`date +%H%M%S` |
@@ -16,30 +17,31 @@ CFGBOB="-c $PREFIX/1/config" | |||
16 | # interactive mode would terminate the test immediately | 17 | # interactive mode would terminate the test immediately |
17 | # because the rest of the script is already in stdin, | 18 | # because the rest of the script is already in stdin, |
18 | # thus redirecting stdin does not suffice) | 19 | # thus redirecting stdin does not suffice) |
19 | #GNUNET_LOG='scalarproduct;;;;DEBUG' | 20 | GNUNET_LOG='scalarproduct*;;;;DEBUG' |
20 | GNUNET_TESTING_PREFIX=$PREFIX ../testbed/gnunet-testbed-profiler -n -c test_scalarproduct.conf -p 2 & | 21 | GNUNET_TESTING_PREFIX=$PREFIX ../testbed/gnunet-testbed-profiler -n -c test_scalarproduct.conf -p 2 & |
21 | PID=$! | 22 | PID=$! |
22 | # sleep 1 is too short on most systems, 2 works on most, 5 seems to be safe | 23 | # sleep 1 is too short on most systems, 2 works on most, 5 seems to be safe |
24 | echo "Waiting for peers to start..." | ||
23 | sleep 5 | 25 | sleep 5 |
26 | echo "Running test..." | ||
24 | 27 | ||
25 | # get bob's peer ID, necessary for alice | 28 | # get bob's peer ID, necessary for alice |
26 | PEERIDBOB=`gnunet-peerinfo -qs $CFGBOB` | 29 | PEERIDBOB=`gnunet-peerinfo -qs $CFGBOB` |
27 | 30 | ||
28 | #GNUNET_LOG=';;;;DEBUG' | 31 | #GNUNET_LOG=';;;;DEBUG' |
29 | gnunet-scalarproduct $CFGBOB $INPUTBOB & | 32 | gnunet-scalarproduct $CFGBOB $INPUTBOB & |
30 | GNUNET_LOG=';;;;DEBUG' | 33 | #GNUNET_LOG=';;;;DEBUG' |
31 | RESULT=`gnunet-scalarproduct $CFGALICE $INPUTALICE -p $PEERIDBOB` | 34 | RESULT=`gnunet-scalarproduct $CFGALICE $INPUTALICE -p $PEERIDBOB` |
32 | 35 | ||
33 | # terminate the testbed | 36 | # terminate the testbed |
34 | kill $PID | 37 | kill $PID |
35 | 38 | ||
36 | EXPECTED="0CCC" | ||
37 | if [ "$RESULT" == "$EXPECTED" ] | 39 | if [ "$RESULT" == "$EXPECTED" ] |
38 | then | 40 | then |
39 | echo "OK" | 41 | echo "OK" |
40 | exit 0 | 42 | exit 0 |
41 | else | 43 | else |
42 | echo "Result $RESULT NOTOK" | 44 | echo "Result $RESULT, expected $EXPECTED - NOTOK" |
43 | exit 1 | 45 | exit 1 |
44 | fi | 46 | fi |
45 | 47 | ||