- removed some optional parts from the SP test config
authorChristian Fuchs <christian.fuchs@cfuchs.net>
Mon, 12 May 2014 15:44:04 +0000 (15:44 +0000)
committerChristian Fuchs <christian.fuchs@cfuchs.net>
Mon, 12 May 2014 15:44:04 +0000 (15:44 +0000)
- 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

src/scalarproduct/gnunet-service-scalarproduct.c
src/scalarproduct/scalarproduct_api.c
src/scalarproduct/test_scalarproduct.conf

index 14711bf0ca8ffb27415e28479dd215fd89ce4839..abf6daa03230617102f64b13e70d5810683dd869 100644 (file)
@@ -2423,6 +2423,8 @@ run (void *cls,
     GNUNET_APPLICATION_TYPE_SCALARPRODUCT,
     0
   };
+  cfg = c;
+  
   //generate private/public key set
   GNUNET_CRYPTO_paillier_create (&my_pubkey, &my_privkey);
 
@@ -2438,9 +2440,9 @@ run (void *cls,
                                    &cb_client_disconnect,
                                    NULL);
   GNUNET_break (GNUNET_OK ==
-                GNUNET_CRYPTO_get_peer_identity (c,
+                GNUNET_CRYPTO_get_peer_identity (cfg,
                                                  &me));
-  my_cadet = GNUNET_CADET_connect (c, NULL,
+  my_cadet = GNUNET_CADET_connect (cfg, NULL,
                                  &cb_channel_incoming,
                                  &cb_channel_destruction,
                                  cadet_handlers, ports);
index 9c497129a71d820c8a845088241dcfba12afbc32..3b92af579d706a5bf9a2981021e7b80532262395 100644 (file)
@@ -273,7 +273,7 @@ send_multipart (void * cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
   msg->header.type = htons (GNUNET_MESSAGE_TYPE_SCALARPRODUCT_CLIENT_MUTLIPART);
   msg->element_count_contained = htonl (todo);
 
-  memcpy (&msg[1], &h->elements[h->element_count_transfered], todo);
+  memcpy (&msg[1], &h->elements[h->element_count_transfered], todo * sizeof (struct GNUNET_SCALARPRODUCT_Element));
   h->element_count_transfered += todo;
 
   h->th = GNUNET_CLIENT_notify_transmit_ready (h->client, size,
@@ -515,7 +515,7 @@ GNUNET_SCALARPRODUCT_start_computation (const struct GNUNET_CONFIGURATION_Handle
     size = sizeof (struct GNUNET_SCALARPRODUCT_computation_message) + possible*sizeof (struct GNUNET_SCALARPRODUCT_Element);
     h->elements = (struct GNUNET_SCALARPRODUCT_Element*) 
             GNUNET_malloc (sizeof(struct GNUNET_SCALARPRODUCT_Element) * element_count);
-    memcpy (h->elements, elements, sizeof (struct GNUNET_SCALARPRODUCT_Element)*element_count);
+    memcpy (h->elements, elements, sizeof (struct GNUNET_SCALARPRODUCT_Element) * element_count);
   }
   
   h->cont_datum = cont;
@@ -533,7 +533,7 @@ GNUNET_SCALARPRODUCT_start_computation (const struct GNUNET_CONFIGURATION_Handle
 
   memcpy (&msg->peer, peer, sizeof (struct GNUNET_PeerIdentity));
   memcpy (&msg->session_key, session_key, sizeof (struct GNUNET_HashCode));
-  memcpy (&msg[1], elements, possible);
+  memcpy (&msg[1], elements, sizeof (struct GNUNET_SCALARPRODUCT_Element) * possible);
 
   h->th = GNUNET_CLIENT_notify_transmit_ready (h->client, size,
                                                GNUNET_TIME_UNIT_FOREVER_REL,
index e80b9dc0ea6e68ae4d0900632661c4f4317d2d09..fb9a34da699b965aea991951409e574974aa7d6e 100644 (file)
@@ -1,94 +1,31 @@
 [arm]
-DEFAULTSERVICES = core cadet statistics scalarproduct
+DEFAULTSERVICES = core cadet statistics scalarproduct set
 PORT = 12366
 
-[ats]
-WAN_QUOTA_OUT = 3932160
-WAN_QUOTA_IN = 3932160
-
-[block]
-plugins = dht test
-
-[consensus]
-AUTOSTART = NO
-
-[core]
-PORT = 12092
-AUTOSTART = YES
-
-[dht]
-AUTOSTART = YES
-DISABLE_TRY_CONNECT = NO
-
-[dhtcache]
-QUOTA = 1 MB
-DATABASE = heap
-
-[dns]
-AUTOSTART = NO
-
-[fs]
-AUTOSTART = NO
-
-[gnunetd]
-HOSTKEY = $SERVICEHOME/.hostkey
-
-[cadet]
-#AUTOSTART = YES
-ACCEPT_FROM = 127.0.0.1;
-PORT = 10700
-
-[nat]
-RETURN_LOCAL_ADDRESSES = YES
-
-[namestore]
-AUTOSTART = NO
-
-[nse]
-AUTOSTART = NO
-
 [PATHS]
 GNUNET_TEST_HOME = /tmp/test-scalarproduct/
 
-[psycstore]
-AUTOSTART = NO
-
-[regex]
-AUTOSTART = NO
-
-[resolver]
-AUTOSTART = NO
-HOSTNAME = localhost
-
-[statistics]
-AUTOSTART = NO
-
 [scalarproduct]
 AUTOSTART = YES
 BINARY = gnunet-service-scalarproduct
-UNIXPATH = $SERVICEHOME/scalarproduct.sock
-#HOME = $SERVICEHOME
+#UNIXPATH = $SERVICEHOME/scalarproduct.sock
+UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-scalarproduct.sock
 HOSTNAME = localhost
 PORT = 13087
+#OPTIONS = -L DEBUG
 
-[transport]
-PLUGINS = tcp
-ACCEPT_FROM6 = ::1;
-ACCEPT_FROM = 127.0.0.1;
-NEIGHBOUR_LIMIT = 50
-PORT = 12365
-
-[transport-tcp]
-TIMEOUT = 300 s
-PORT = 12368
+[set]
+AUTOSTART = YES
+PORT = 12106
+HOSTNAME = localhost
+BINARY = gnunet-service-set
+#ACCEPT_FROM = 127.0.0.1;
+#ACCEPT_FROM6 = ::1;
+#UNIXPATH = $SERVICEHOME/set.sock
+UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-set.sock
+#UNIX_MATCH_UID = YES
+#UNIX_MATCH_GID = YES
+#OPTIONS = -L DEBUG
 
 [testbed]
-OVERLAY_TOPOLOGY = LINE
-
-[TESTING]
-WEAKRANDOM = YES
-
-[vpn]
-AUTOSTART = NO
-
-
+OVERLAY_TOPOLOGY = CLIQUE
\ No newline at end of file