aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2014-12-07 00:42:31 +0000
committerChristian Grothoff <christian@grothoff.org>2014-12-07 00:42:31 +0000
commitd30f73b49715899b2aa12e4819a0e105994c5411 (patch)
treea1c2ff23e637053477334bddcbe4e8969c6cfc5d /src
parent7b993324a717497da6d34573a45150c48ca8786f (diff)
downloadgnunet-d30f73b49715899b2aa12e4819a0e105994c5411.tar.gz
gnunet-d30f73b49715899b2aa12e4819a0e105994c5411.zip
-fix some of the obvious issues
Diffstat (limited to 'src')
-rw-r--r--src/scalarproduct/gnunet-service-scalarproduct_alice.c8
-rw-r--r--src/scalarproduct/gnunet-service-scalarproduct_bob.c6
-rw-r--r--src/scalarproduct/scalarproduct.conf.in13
-rw-r--r--src/scalarproduct/test_scalarproduct.conf22
-rwxr-xr-xsrc/scalarproduct/test_scalarproduct.sh10
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
817element_cmp (const void *a, 817element_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
815element_cmp (const void *a, 815element_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]
2AUTOSTART = @AUTOSTART@
2BINARY = gnunet-service-scalarproduct-alice 3BINARY = gnunet-service-scalarproduct-alice
3UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-scalarproduct-alice.sock 4UNIXPATH = $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;
8UNIX_MATCH_UID = NO
9UNIX_MATCH_GID = YES
10#OPTIONS = -L DEBUG
5 11
6[scalarproduct-bob] 12[scalarproduct-bob]
13AUTOSTART = @AUTOSTART@
14HOSTNAME = localhost
7BINARY = gnunet-service-scalarproduct-bob 15BINARY = gnunet-service-scalarproduct-bob
8UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-scalarproduct-bob.sock 16UNIXPATH = $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;
21UNIX_MATCH_UID = NO
22UNIX_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]
6GNUNET_TEST_HOME = /tmp/test-scalarproduct/ 6GNUNET_TEST_HOME = /tmp/test-scalarproduct/
7 7
8[scalarproduct]
9AUTOSTART = YES
10BINARY = gnunet-service-scalarproduct
11#UNIXPATH = $SERVICEHOME/scalarproduct.sock
12UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-scalarproduct.sock
13HOSTNAME = localhost
14PORT = 13087
15#OPTIONS = -L DEBUG
16
17[set]
18AUTOSTART = YES
19PORT = 12106
20HOSTNAME = localhost
21BINARY = gnunet-service-set
22#ACCEPT_FROM = 127.0.0.1;
23#ACCEPT_FROM6 = ::1;
24#UNIXPATH = $SERVICEHOME/set.sock
25UNIXPATH = $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]
31OVERLAY_TOPOLOGY = CLIQUE \ No newline at end of file 9OVERLAY_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:
4INPUTALICE="-k CCC -e 'AB,10;RO,3;FL,3;LOL,-1;'" 4INPUTALICE="-k CCC -e 'AB,10;RO,3;FL,3;LOL,-1;'"
5INPUTBOB="-k CCC -e 'BC,-20000;RO,1000;FL,100;LOL,24;'" 5INPUTBOB="-k CCC -e 'BC,-20000;RO,1000;FL,100;LOL,24;'"
6EXPECTED="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
8PREFIX=/tmp/test-scalarproduct`date +%H%M%S` 9PREFIX=/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' 20GNUNET_LOG='scalarproduct*;;;;DEBUG'
20GNUNET_TESTING_PREFIX=$PREFIX ../testbed/gnunet-testbed-profiler -n -c test_scalarproduct.conf -p 2 & 21GNUNET_TESTING_PREFIX=$PREFIX ../testbed/gnunet-testbed-profiler -n -c test_scalarproduct.conf -p 2 &
21PID=$! 22PID=$!
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
24echo "Waiting for peers to start..."
23sleep 5 25sleep 5
26echo "Running test..."
24 27
25# get bob's peer ID, necessary for alice 28# get bob's peer ID, necessary for alice
26PEERIDBOB=`gnunet-peerinfo -qs $CFGBOB` 29PEERIDBOB=`gnunet-peerinfo -qs $CFGBOB`
27 30
28#GNUNET_LOG=';;;;DEBUG' 31#GNUNET_LOG=';;;;DEBUG'
29gnunet-scalarproduct $CFGBOB $INPUTBOB & 32gnunet-scalarproduct $CFGBOB $INPUTBOB &
30GNUNET_LOG=';;;;DEBUG' 33#GNUNET_LOG=';;;;DEBUG'
31RESULT=`gnunet-scalarproduct $CFGALICE $INPUTALICE -p $PEERIDBOB` 34RESULT=`gnunet-scalarproduct $CFGALICE $INPUTALICE -p $PEERIDBOB`
32 35
33# terminate the testbed 36# terminate the testbed
34kill $PID 37kill $PID
35 38
36EXPECTED="0CCC"
37if [ "$RESULT" == "$EXPECTED" ] 39if [ "$RESULT" == "$EXPECTED" ]
38then 40then
39 echo "OK" 41 echo "OK"
40 exit 0 42 exit 0
41else 43else
42 echo "Result $RESULT NOTOK" 44 echo "Result $RESULT, expected $EXPECTED - NOTOK"
43 exit 1 45 exit 1
44fi 46fi
45 47