aboutsummaryrefslogtreecommitdiff
path: root/src/scalarproduct/scalarproduct_api.c
diff options
context:
space:
mode:
authorChristian Fuchs <christian.fuchs@cfuchs.net>2014-05-12 15:44:04 +0000
committerChristian Fuchs <christian.fuchs@cfuchs.net>2014-05-12 15:44:04 +0000
commita9670db6f78bdc4be16dc856a02fe42f4e039f93 (patch)
tree36d15444e0a8f06d63c27d7e9c7b684698a51bda /src/scalarproduct/scalarproduct_api.c
parentfbfdc8a66888a992517ee61bfb9c39784b2cee83 (diff)
downloadgnunet-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/scalarproduct_api.c')
-rw-r--r--src/scalarproduct/scalarproduct_api.c6
1 files changed, 3 insertions, 3 deletions
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,