diff options
author | Christian Fuchs <christian.fuchs@cfuchs.net> | 2013-09-11 12:20:03 +0000 |
---|---|---|
committer | Christian Fuchs <christian.fuchs@cfuchs.net> | 2013-09-11 12:20:03 +0000 |
commit | 30b74c15b7f76b0371495f79447a8aaebcc71636 (patch) | |
tree | c3a346f2ee2b695f5c895d617fe05a3c71528747 /src/scalarproduct/scalarproduct_api.c | |
parent | 70cb9504b1f82b0ee580a464ee1929cb0b314ff8 (diff) | |
download | gnunet-30b74c15b7f76b0371495f79447a8aaebcc71636.tar.gz gnunet-30b74c15b7f76b0371495f79447a8aaebcc71636.zip |
added propper shutdown task to SP-client
fixed a logics mixup in the SP-API between alice's client and bob's client-function
fixed a memory allocation bug in SP-API
adjusted message formats to use uint32_t instead of 16 for all element counts and mask lengths
Diffstat (limited to 'src/scalarproduct/scalarproduct_api.c')
-rw-r--r-- | src/scalarproduct/scalarproduct_api.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/scalarproduct/scalarproduct_api.c b/src/scalarproduct/scalarproduct_api.c index bfdf04de4..91f1992f9 100644 --- a/src/scalarproduct/scalarproduct_api.c +++ b/src/scalarproduct/scalarproduct_api.c | |||
@@ -351,14 +351,14 @@ GNUNET_SCALARPRODUCT_response (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
351 | 351 | ||
352 | h->cont_status = cont; | 352 | h->cont_status = cont; |
353 | h->cont_cls = cont_cls; | 353 | h->cont_cls = cont_cls; |
354 | h->response_proc = &process_result_message; | 354 | h->response_proc = &process_status_message; |
355 | h->cfg = cfg; | 355 | h->cfg = cfg; |
356 | h->msg = GNUNET_malloc (size); | ||
357 | memcpy (&h->key, key, sizeof (struct GNUNET_HashCode)); | 356 | memcpy (&h->key, key, sizeof (struct GNUNET_HashCode)); |
358 | 357 | ||
359 | msg = (struct GNUNET_SCALARPRODUCT_client_request*) h->msg; | 358 | msg = (struct GNUNET_SCALARPRODUCT_client_request*) GNUNET_malloc (size); |
359 | h->msg = msg; | ||
360 | msg->header.size = htons (size); | 360 | msg->header.size = htons (size); |
361 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_SCALARPRODUCT_CLIENT_TO_ALICE); | 361 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_SCALARPRODUCT_CLIENT_TO_BOB); |
362 | msg->element_count = htonl (element_count); | 362 | msg->element_count = htonl (element_count); |
363 | 363 | ||
364 | vector = (int32_t*) & msg[1]; | 364 | vector = (int32_t*) & msg[1]; |
@@ -444,16 +444,16 @@ GNUNET_SCALARPRODUCT_request (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
444 | 444 | ||
445 | h->cont_datum = cont; | 445 | h->cont_datum = cont; |
446 | h->cont_cls = cont_cls; | 446 | h->cont_cls = cont_cls; |
447 | h->response_proc = &process_status_message; | 447 | h->response_proc = &process_result_message; |
448 | h->cfg = cfg; | 448 | h->cfg = cfg; |
449 | memcpy (&h->key, key, sizeof (struct GNUNET_HashCode)); | 449 | memcpy (&h->key, key, sizeof (struct GNUNET_HashCode)); |
450 | 450 | ||
451 | msg = (struct GNUNET_SCALARPRODUCT_client_request*) GNUNET_malloc (size); | 451 | msg = (struct GNUNET_SCALARPRODUCT_client_request*) GNUNET_malloc (size); |
452 | h->msg = msg; | 452 | h->msg = msg; |
453 | msg->header.size = htons (size); | 453 | msg->header.size = htons (size); |
454 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_SCALARPRODUCT_CLIENT_TO_ALICE); | 454 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_SCALARPRODUCT_CLIENT_TO_ALICE); |
455 | msg->element_count = htons (element_count); | 455 | msg->element_count = htonl (element_count); |
456 | msg->mask_length = htons (mask_bytes); | 456 | msg->mask_length = htonl (mask_bytes); |
457 | 457 | ||
458 | vector = (int32_t*) & msg[1]; | 458 | vector = (int32_t*) & msg[1]; |
459 | // copy each element over to the message | 459 | // copy each element over to the message |