diff options
author | Christian Fuchs <christian.fuchs@cfuchs.net> | 2013-09-02 21:15:01 +0000 |
---|---|---|
committer | Christian Fuchs <christian.fuchs@cfuchs.net> | 2013-09-02 21:15:01 +0000 |
commit | eee4dba55bb2ce508f087cef09536a4ce2f2a42f (patch) | |
tree | a8c7ab36d43fbe5eb0a784b8ddaf2746608c6b16 /src/scalarproduct | |
parent | de62048ab84c178fbf57682b6f9310904ff38964 (diff) | |
download | gnunet-eee4dba55bb2ce508f087cef09536a4ce2f2a42f.tar.gz gnunet-eee4dba55bb2ce508f087cef09536a4ce2f2a42f.zip |
synced API definitions again
session now get properly terminated in case we can no send to the service.
implemented/added cancel functionality
Diffstat (limited to 'src/scalarproduct')
-rw-r--r-- | src/scalarproduct/gnunet-scalarproduct.c | 4 | ||||
-rw-r--r-- | src/scalarproduct/scalarproduct_api.c | 155 | ||||
-rw-r--r-- | src/scalarproduct/test_scalarproduct_api.c | 2 | ||||
-rw-r--r-- | src/scalarproduct/test_scalarproduct_api_4peers.c | 2 | ||||
-rw-r--r-- | src/scalarproduct/test_scalarproduct_api_regression.c | 2 | ||||
-rw-r--r-- | src/scalarproduct/test_scalarproduct_api_regression2.c | 2 |
6 files changed, 76 insertions, 91 deletions
diff --git a/src/scalarproduct/gnunet-scalarproduct.c b/src/scalarproduct/gnunet-scalarproduct.c index 2fc2ab720..78acb62ce 100644 --- a/src/scalarproduct/gnunet-scalarproduct.c +++ b/src/scalarproduct/gnunet-scalarproduct.c | |||
@@ -141,7 +141,7 @@ responder_callback (void *cls, | |||
141 | LOG (GNUNET_ERROR_TYPE_ERROR, "Session %s failed: return code %d\n", GNUNET_h2s (key), (int) status); | 141 | LOG (GNUNET_ERROR_TYPE_ERROR, "Session %s failed: return code %d\n", GNUNET_h2s (key), (int) status); |
142 | } | 142 | } |
143 | 143 | ||
144 | GNUNET_SCALARPRODUCT_disconnect (handle); | 144 | GNUNET_SCALARPRODUCT_cancel (handle); |
145 | GNUNET_SCHEDULER_shutdown (); | 145 | GNUNET_SCHEDULER_shutdown (); |
146 | } | 146 | } |
147 | 147 | ||
@@ -209,7 +209,7 @@ requester_callback (void *cls, | |||
209 | default: | 209 | default: |
210 | LOG (GNUNET_ERROR_TYPE_ERROR, "Session %s failed: return code %d\n", GNUNET_h2s (key), (int) status); | 210 | LOG (GNUNET_ERROR_TYPE_ERROR, "Session %s failed: return code %d\n", GNUNET_h2s (key), (int) status); |
211 | } | 211 | } |
212 | GNUNET_SCALARPRODUCT_disconnect (handle); | 212 | GNUNET_SCALARPRODUCT_cancel (handle); |
213 | GNUNET_SCHEDULER_shutdown (); | 213 | GNUNET_SCHEDULER_shutdown (); |
214 | } | 214 | } |
215 | 215 | ||
diff --git a/src/scalarproduct/scalarproduct_api.c b/src/scalarproduct/scalarproduct_api.c index 118de4a04..633034b31 100644 --- a/src/scalarproduct/scalarproduct_api.c +++ b/src/scalarproduct/scalarproduct_api.c | |||
@@ -52,7 +52,7 @@ struct GNUNET_SCALARPRODUCT_ComputationHandle | |||
52 | * This is a linked list. | 52 | * This is a linked list. |
53 | */ | 53 | */ |
54 | struct GNUNET_SCALARPRODUCT_ComputationHandle *prev; | 54 | struct GNUNET_SCALARPRODUCT_ComputationHandle *prev; |
55 | 55 | ||
56 | /** | 56 | /** |
57 | * Our configuration. | 57 | * Our configuration. |
58 | */ | 58 | */ |
@@ -72,7 +72,7 @@ struct GNUNET_SCALARPRODUCT_ComputationHandle | |||
72 | * The shared session key identifying this computation | 72 | * The shared session key identifying this computation |
73 | */ | 73 | */ |
74 | struct GNUNET_HashCode * key; | 74 | struct GNUNET_HashCode * key; |
75 | 75 | ||
76 | /** | 76 | /** |
77 | * Current transmit handle. | 77 | * Current transmit handle. |
78 | */ | 78 | */ |
@@ -129,33 +129,14 @@ static struct GNUNET_SCALARPRODUCT_ComputationHandle *tail; | |||
129 | *** Function Declarations ********** | 129 | *** Function Declarations ********** |
130 | **************************************************************/ | 130 | **************************************************************/ |
131 | 131 | ||
132 | /** | 132 | void |
133 | * Called when a response is received from the service. After basic check | 133 | GNUNET_SCALARPRODUCT_cancel (struct GNUNET_SCALARPRODUCT_ComputationHandle * h); |
134 | * handler in qe->response_proc is called. This functions handles the response | ||
135 | * to the client which used the API. | ||
136 | * | ||
137 | * @param cls Pointer to the Master Context | ||
138 | * @param msg Pointer to the data received in response | ||
139 | */ | ||
140 | static void | ||
141 | receive_cb (void *cls, const struct GNUNET_MessageHeader *msg); | ||
142 | |||
143 | /** | ||
144 | * Transmits the request to the VectorProduct Sevice | ||
145 | * | ||
146 | * @param cls Closure | ||
147 | * @param size Size of the buffer | ||
148 | * @param buf Pointer to the buffer | ||
149 | * | ||
150 | * @return Size of the message sent | ||
151 | */ | ||
152 | static size_t transmit_request (void *cls, size_t size, | ||
153 | void *buf); | ||
154 | 134 | ||
155 | /************************************************************** | 135 | /************************************************************** |
156 | *** Static Function Declarations ********** | 136 | *** Static Function Declarations ********** |
157 | **************************************************************/ | 137 | **************************************************************/ |
158 | 138 | ||
139 | |||
159 | /** | 140 | /** |
160 | * Handles the RESULT received in reply of prepare_response from the | 141 | * Handles the RESULT received in reply of prepare_response from the |
161 | * service | 142 | * service |
@@ -194,31 +175,32 @@ process_result_message (void *cls, | |||
194 | if (GNUNET_SCALARPRODUCT_Status_Success == status | 175 | if (GNUNET_SCALARPRODUCT_Status_Success == status |
195 | && qe->cont_datum != NULL) | 176 | && qe->cont_datum != NULL) |
196 | { | 177 | { |
197 | size_t product_len = ntohl(message->product_length); | 178 | size_t product_len = ntohl (message->product_length); |
198 | result = gcry_mpi_new(0); | 179 | result = gcry_mpi_new (0); |
199 | 180 | ||
200 | if (0 < product_len) | 181 | if (0 < product_len) |
201 | { | 182 | { |
202 | gcry_mpi_t num; | 183 | gcry_mpi_t num; |
203 | size_t read = 0; | 184 | size_t read = 0; |
204 | 185 | ||
205 | if (0 != gcry_mpi_scan (&num, GCRYMPI_FMT_USG, &msg[1], product_len, &read)){ | 186 | if (0 != gcry_mpi_scan (&num, GCRYMPI_FMT_USG, &msg[1], product_len, &read)) |
187 | { | ||
206 | LOG (GNUNET_ERROR_TYPE_ERROR, "Could not convert to mpi to value!\n"); | 188 | LOG (GNUNET_ERROR_TYPE_ERROR, "Could not convert to mpi to value!\n"); |
207 | gcry_mpi_release(result); | 189 | gcry_mpi_release (result); |
208 | result = NULL; | 190 | result = NULL; |
209 | status = GNUNET_SCALARPRODUCT_Status_InvalidResponse; | 191 | status = GNUNET_SCALARPRODUCT_Status_InvalidResponse; |
210 | } | 192 | } |
211 | else | 193 | else |
212 | { | 194 | { |
213 | if (message->range > 0) | 195 | if (message->range > 0) |
214 | gcry_mpi_add(result, result, num); | 196 | gcry_mpi_add (result, result, num); |
215 | else | 197 | else |
216 | gcry_mpi_sub(result, result, num); | 198 | gcry_mpi_sub (result, result, num); |
217 | gcry_mpi_release(num); | 199 | gcry_mpi_release (num); |
218 | } | 200 | } |
219 | } | 201 | } |
220 | } | 202 | } |
221 | qe->cont_datum (qe->cont_cls, status, result); | 203 | qe->cont_datum (qe->cont_cls, status, result); |
222 | } | 204 | } |
223 | 205 | ||
224 | 206 | ||
@@ -243,7 +225,7 @@ receive_cb (void *cls, const struct GNUNET_MessageHeader *msg) | |||
243 | LOG (GNUNET_ERROR_TYPE_WARNING, "Disconnected by Service.\n"); | 225 | LOG (GNUNET_ERROR_TYPE_WARNING, "Disconnected by Service.\n"); |
244 | status = GNUNET_SCALARPRODUCT_Status_ServiceDisconnected; | 226 | status = GNUNET_SCALARPRODUCT_Status_ServiceDisconnected; |
245 | } | 227 | } |
246 | else if ( GNUNET_MESSAGE_TYPE_SCALARPRODUCT_SERVICE_TO_CLIENT != ntohs (msg->type)) | 228 | else if (GNUNET_MESSAGE_TYPE_SCALARPRODUCT_SERVICE_TO_CLIENT != ntohs (msg->type)) |
247 | { | 229 | { |
248 | LOG (GNUNET_ERROR_TYPE_WARNING, "Invalid message type received\n"); | 230 | LOG (GNUNET_ERROR_TYPE_WARNING, "Invalid message type received\n"); |
249 | } | 231 | } |
@@ -256,7 +238,7 @@ receive_cb (void *cls, const struct GNUNET_MessageHeader *msg) | |||
256 | 238 | ||
257 | status = GNUNET_SCALARPRODUCT_Status_Success; | 239 | status = GNUNET_SCALARPRODUCT_Status_Success; |
258 | } | 240 | } |
259 | 241 | ||
260 | if (qe->cont_datum != NULL) | 242 | if (qe->cont_datum != NULL) |
261 | qe->response_proc (qe, msg, status); | 243 | qe->response_proc (qe, msg, status); |
262 | 244 | ||
@@ -278,22 +260,22 @@ transmit_request (void *cls, size_t size, | |||
278 | void *buf) | 260 | void *buf) |
279 | { | 261 | { |
280 | struct GNUNET_SCALARPRODUCT_ComputationHandle *qe = cls; | 262 | struct GNUNET_SCALARPRODUCT_ComputationHandle *qe = cls; |
281 | 263 | ||
282 | if (NULL == buf) | 264 | if (NULL == buf) |
283 | { | 265 | { |
284 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Failed to transmit request to SCALARPRODUCT.\n"); | 266 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Failed to transmit request to SCALARPRODUCT.\n"); |
285 | GNUNET_STATISTICS_update (qe->stats, | 267 | GNUNET_STATISTICS_update (qe->stats, |
286 | gettext_noop ("# transmission request failures"), | 268 | gettext_noop ("# transmission request failures"), |
287 | 1, GNUNET_NO); | 269 | 1, GNUNET_NO); |
288 | 270 | ||
289 | // notify caller about the error, done here. | 271 | // notify caller about the error, done here. |
290 | if (qe->cont_datum != NULL) | 272 | if (qe->cont_datum != NULL) |
291 | qe->response_proc (qe, NULL, GNUNET_SCALARPRODUCT_Status_Failure); | 273 | qe->response_proc (qe, NULL, GNUNET_SCALARPRODUCT_Status_Failure); |
292 | GNUNET_SCALARPRODUCT_cancel(cls); | 274 | GNUNET_SCALARPRODUCT_cancel (cls); |
293 | return 0; | 275 | return 0; |
294 | } | 276 | } |
295 | memcpy (buf, qe->msg, size); | 277 | memcpy (buf, qe->msg, size); |
296 | 278 | ||
297 | GNUNET_free (qe->msg); | 279 | GNUNET_free (qe->msg); |
298 | qe->msg = NULL; | 280 | qe->msg = NULL; |
299 | qe->th = NULL; | 281 | qe->th = NULL; |
@@ -338,52 +320,53 @@ GNUNET_SCALARPRODUCT_response (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
338 | int32_t * vector; | 320 | int32_t * vector; |
339 | uint16_t size; | 321 | uint16_t size; |
340 | uint64_t i; | 322 | uint64_t i; |
341 | 323 | ||
342 | GNUNET_assert(key); | 324 | GNUNET_assert (key); |
343 | GNUNET_assert(elements); | 325 | GNUNET_assert (elements); |
344 | GNUNET_assert(cont); | 326 | GNUNET_assert (cont); |
345 | GNUNET_assert(element_count > 1); | 327 | GNUNET_assert (element_count > 1); |
346 | GNUNET_assert (GNUNET_SERVER_MAX_MESSAGE_SIZE >= sizeof (struct GNUNET_SCALARPRODUCT_client_request) | 328 | GNUNET_assert (GNUNET_SERVER_MAX_MESSAGE_SIZE >= sizeof (struct GNUNET_SCALARPRODUCT_client_request) |
347 | + element_count * sizeof (int32_t)); | 329 | +element_count * sizeof (int32_t)); |
348 | h = GNUNET_new (struct GNUNET_SCALARPRODUCT_ComputationHandle); | 330 | h = GNUNET_new (struct GNUNET_SCALARPRODUCT_ComputationHandle); |
349 | h->client = GNUNET_CLIENT_connect ("scalarproduct", cfg); | 331 | h->client = GNUNET_CLIENT_connect ("scalarproduct", cfg); |
350 | if (!h->client) | 332 | if (!h->client) |
351 | { | 333 | { |
352 | LOG (GNUNET_ERROR_TYPE_ERROR, | 334 | LOG (GNUNET_ERROR_TYPE_ERROR, |
353 | _ ("Failed to connect to the scalarproduct service\n")); | 335 | _ ("Failed to connect to the scalarproduct service\n")); |
354 | GNUNET_free(h); | 336 | GNUNET_free (h); |
355 | return NULL; | 337 | return NULL; |
356 | } | 338 | } |
357 | h->stats = GNUNET_STATISTICS_create ("scalarproduct-api", cfg); | 339 | h->stats = GNUNET_STATISTICS_create ("scalarproduct-api", cfg); |
358 | if (!h->th){ | 340 | if (!h->th) |
341 | { | ||
359 | LOG (GNUNET_ERROR_TYPE_ERROR, | 342 | LOG (GNUNET_ERROR_TYPE_ERROR, |
360 | _("Failed to send a message to the statistics service\n")); | 343 | _ ("Failed to send a message to the statistics service\n")); |
361 | GNUNET_CLIENT_disconnect(h->client); | 344 | GNUNET_CLIENT_disconnect (h->client); |
362 | GNUNET_free(h); | 345 | GNUNET_free (h); |
363 | return NULL; | 346 | return NULL; |
364 | } | 347 | } |
365 | 348 | ||
366 | size = sizeof (struct GNUNET_SCALARPRODUCT_client_request) + element_count * sizeof (int32_t); | 349 | size = sizeof (struct GNUNET_SCALARPRODUCT_client_request) +element_count * sizeof (int32_t); |
367 | 350 | ||
368 | h->cont_status = cont; | 351 | h->cont_status = cont; |
369 | h->cont_cls = cont_cls; | 352 | h->cont_cls = cont_cls; |
370 | h->response_proc = &process_result_message; | 353 | h->response_proc = &process_result_message; |
371 | h->cfg = cfg; | 354 | h->cfg = cfg; |
372 | h->msg = GNUNET_malloc (size); | 355 | h->msg = GNUNET_malloc (size); |
373 | memcpy (&h->key, key, sizeof (struct GNUNET_HashCode)); | 356 | memcpy (&h->key, key, sizeof (struct GNUNET_HashCode)); |
374 | 357 | ||
375 | msg = (struct GNUNET_SCALARPRODUCT_client_request*) h->msg; | 358 | msg = (struct GNUNET_SCALARPRODUCT_client_request*) h->msg; |
376 | msg->header.size = htons (size); | 359 | msg->header.size = htons (size); |
377 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_SCALARPRODUCT_CLIENT_TO_ALICE); | 360 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_SCALARPRODUCT_CLIENT_TO_ALICE); |
378 | msg->element_count = htonl (element_count); | 361 | msg->element_count = htonl (element_count); |
379 | 362 | ||
380 | vector = (int32_t*) &msg[1]; | 363 | vector = (int32_t*) & msg[1]; |
381 | // copy each element over to the message | 364 | // copy each element over to the message |
382 | for (i = 0; i < element_count; i++) | 365 | for (i = 0; i < element_count; i++) |
383 | vector[i] = htonl(elements[i]); | 366 | vector[i] = htonl (elements[i]); |
384 | 367 | ||
385 | memcpy (&msg->key, key, sizeof (struct GNUNET_HashCode)); | 368 | memcpy (&msg->key, key, sizeof (struct GNUNET_HashCode)); |
386 | 369 | ||
387 | h->th = GNUNET_CLIENT_notify_transmit_ready (h->client, size, | 370 | h->th = GNUNET_CLIENT_notify_transmit_ready (h->client, size, |
388 | GNUNET_TIME_UNIT_FOREVER_REL, | 371 | GNUNET_TIME_UNIT_FOREVER_REL, |
389 | GNUNET_YES, // retry is OK in the initial stage | 372 | GNUNET_YES, // retry is OK in the initial stage |
@@ -392,10 +375,10 @@ GNUNET_SCALARPRODUCT_response (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
392 | { | 375 | { |
393 | LOG (GNUNET_ERROR_TYPE_ERROR, | 376 | LOG (GNUNET_ERROR_TYPE_ERROR, |
394 | _ ("Failed to send a message to the scalarproduct service\n")); | 377 | _ ("Failed to send a message to the scalarproduct service\n")); |
395 | GNUNET_STATISTICS_destroy(h->stats, GNUNET_YES); | 378 | GNUNET_STATISTICS_destroy (h->stats, GNUNET_YES); |
396 | GNUNET_CLIENT_disconnect(h->client); | 379 | GNUNET_CLIENT_disconnect (h->client); |
397 | GNUNET_free(h->msg); | 380 | GNUNET_free (h->msg); |
398 | GNUNET_free(h); | 381 | GNUNET_free (h); |
399 | return NULL; | 382 | return NULL; |
400 | } | 383 | } |
401 | GNUNET_CONTAINER_DLL_insert (head, tail, h); | 384 | GNUNET_CONTAINER_DLL_insert (head, tail, h); |
@@ -432,53 +415,54 @@ GNUNET_SCALARPRODUCT_request (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
432 | int32_t * vector; | 415 | int32_t * vector; |
433 | uint16_t size; | 416 | uint16_t size; |
434 | uint64_t i; | 417 | uint64_t i; |
435 | 418 | ||
436 | GNUNET_assert (GNUNET_SERVER_MAX_MESSAGE_SIZE >= sizeof (struct GNUNET_SCALARPRODUCT_client_request) | 419 | GNUNET_assert (GNUNET_SERVER_MAX_MESSAGE_SIZE >= sizeof (struct GNUNET_SCALARPRODUCT_client_request) |
437 | + element_count * sizeof (int32_t) | 420 | +element_count * sizeof (int32_t) |
438 | + mask_bytes); | 421 | + mask_bytes); |
439 | 422 | ||
440 | h = GNUNET_new (struct GNUNET_SCALARPRODUCT_ComputationHandle); | 423 | h = GNUNET_new (struct GNUNET_SCALARPRODUCT_ComputationHandle); |
441 | h->client = GNUNET_CLIENT_connect ("scalarproduct", cfg); | 424 | h->client = GNUNET_CLIENT_connect ("scalarproduct", cfg); |
442 | if (!h->client) | 425 | if (!h->client) |
443 | { | 426 | { |
444 | LOG (GNUNET_ERROR_TYPE_ERROR, | 427 | LOG (GNUNET_ERROR_TYPE_ERROR, |
445 | _ ("Failed to connect to the scalarproduct service\n")); | 428 | _ ("Failed to connect to the scalarproduct service\n")); |
446 | GNUNET_free(h); | 429 | GNUNET_free (h); |
447 | return NULL; | 430 | return NULL; |
448 | } | 431 | } |
449 | h->stats = GNUNET_STATISTICS_create ("scalarproduct-api", cfg); | 432 | h->stats = GNUNET_STATISTICS_create ("scalarproduct-api", cfg); |
450 | if (!h->th){ | 433 | if (!h->th) |
434 | { | ||
451 | LOG (GNUNET_ERROR_TYPE_ERROR, | 435 | LOG (GNUNET_ERROR_TYPE_ERROR, |
452 | _("Failed to send a message to the statistics service\n")); | 436 | _ ("Failed to send a message to the statistics service\n")); |
453 | GNUNET_CLIENT_disconnect(h->client); | 437 | GNUNET_CLIENT_disconnect (h->client); |
454 | GNUNET_free(h); | 438 | GNUNET_free (h); |
455 | return NULL; | 439 | return NULL; |
456 | } | 440 | } |
457 | 441 | ||
458 | size = sizeof (struct GNUNET_SCALARPRODUCT_client_request) + element_count * sizeof (int32_t) + mask_bytes; | 442 | size = sizeof (struct GNUNET_SCALARPRODUCT_client_request) +element_count * sizeof (int32_t) + mask_bytes; |
459 | 443 | ||
460 | h->cont_datum = cont; | 444 | h->cont_datum = cont; |
461 | h->cont_cls = cont_cls; | 445 | h->cont_cls = cont_cls; |
462 | h->response_proc = &process_status_message; | 446 | h->response_proc = &process_status_message; |
463 | h->cfg = cfg; | 447 | h->cfg = cfg; |
464 | h->msg = GNUNET_malloc (size); | 448 | h->msg = GNUNET_malloc (size); |
465 | memcpy (&h->key, key, sizeof (struct GNUNET_HashCode)); | 449 | memcpy (&h->key, key, sizeof (struct GNUNET_HashCode)); |
466 | 450 | ||
467 | msg = (struct GNUNET_SCALARPRODUCT_client_request*) h->msg; | 451 | msg = (struct GNUNET_SCALARPRODUCT_client_request*) h->msg; |
468 | msg->header.size = htons (size); | 452 | msg->header.size = htons (size); |
469 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_SCALARPRODUCT_CLIENT_TO_ALICE); | 453 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_SCALARPRODUCT_CLIENT_TO_ALICE); |
470 | msg->element_count = htons (element_count); | 454 | msg->element_count = htons (element_count); |
471 | msg->mask_length = htons (mask_bytes); | 455 | msg->mask_length = htons (mask_bytes); |
472 | 456 | ||
473 | vector = (int32_t*) &msg[1]; | 457 | vector = (int32_t*) & msg[1]; |
474 | // copy each element over to the message | 458 | // copy each element over to the message |
475 | for (i = 0; i < element_count; i++) | 459 | for (i = 0; i < element_count; i++) |
476 | vector[i] = htonl(elements[i]); | 460 | vector[i] = htonl (elements[i]); |
477 | 461 | ||
478 | memcpy (&msg->peer, peer, sizeof (struct GNUNET_PeerIdentity)); | 462 | memcpy (&msg->peer, peer, sizeof (struct GNUNET_PeerIdentity)); |
479 | memcpy (&msg->key, key, sizeof (struct GNUNET_HashCode)); | 463 | memcpy (&msg->key, key, sizeof (struct GNUNET_HashCode)); |
480 | memcpy (&vector[element_count], mask, mask_bytes); | 464 | memcpy (&vector[element_count], mask, mask_bytes); |
481 | 465 | ||
482 | h->th = GNUNET_CLIENT_notify_transmit_ready (h->client, size, | 466 | h->th = GNUNET_CLIENT_notify_transmit_ready (h->client, size, |
483 | GNUNET_TIME_UNIT_FOREVER_REL, | 467 | GNUNET_TIME_UNIT_FOREVER_REL, |
484 | GNUNET_YES, // retry is OK in the initial stage | 468 | GNUNET_YES, // retry is OK in the initial stage |
@@ -487,16 +471,17 @@ GNUNET_SCALARPRODUCT_request (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
487 | { | 471 | { |
488 | LOG (GNUNET_ERROR_TYPE_ERROR, | 472 | LOG (GNUNET_ERROR_TYPE_ERROR, |
489 | _ ("Failed to send a message to the scalarproduct service\n")); | 473 | _ ("Failed to send a message to the scalarproduct service\n")); |
490 | GNUNET_STATISTICS_destroy(h->stats, GNUNET_YES); | 474 | GNUNET_STATISTICS_destroy (h->stats, GNUNET_YES); |
491 | GNUNET_CLIENT_disconnect(h->client); | 475 | GNUNET_CLIENT_disconnect (h->client); |
492 | GNUNET_free(h->msg); | 476 | GNUNET_free (h->msg); |
493 | GNUNET_free(h); | 477 | GNUNET_free (h); |
494 | return NULL; | 478 | return NULL; |
495 | } | 479 | } |
496 | GNUNET_CONTAINER_DLL_insert (head, tail, h); | 480 | GNUNET_CONTAINER_DLL_insert (head, tail, h); |
497 | return h; | 481 | return h; |
498 | } | 482 | } |
499 | 483 | ||
484 | |||
500 | /** | 485 | /** |
501 | * Disconnect from the scalarproduct service. | 486 | * Disconnect from the scalarproduct service. |
502 | * | 487 | * |
diff --git a/src/scalarproduct/test_scalarproduct_api.c b/src/scalarproduct/test_scalarproduct_api.c index 9ef9535e7..e28074fd4 100644 --- a/src/scalarproduct/test_scalarproduct_api.c +++ b/src/scalarproduct/test_scalarproduct_api.c | |||
@@ -681,7 +681,7 @@ scalarproduct_da (void *cls, void *op_result) | |||
681 | { | 681 | { |
682 | struct PeerData* peer = (struct PeerData*) cls; | 682 | struct PeerData* peer = (struct PeerData*) cls; |
683 | 683 | ||
684 | GNUNET_SCALARPRODUCT_disconnect (peer->vh); | 684 | GNUNET_SCALARPRODUCT_cancel (peer->vh); |
685 | return; | 685 | return; |
686 | } | 686 | } |
687 | 687 | ||
diff --git a/src/scalarproduct/test_scalarproduct_api_4peers.c b/src/scalarproduct/test_scalarproduct_api_4peers.c index 70c763ca6..c0e045e28 100644 --- a/src/scalarproduct/test_scalarproduct_api_4peers.c +++ b/src/scalarproduct/test_scalarproduct_api_4peers.c | |||
@@ -817,7 +817,7 @@ scalarproduct_da (void *cls, void *op_result) | |||
817 | { | 817 | { |
818 | struct PeerData* peer = (struct PeerData*) cls; | 818 | struct PeerData* peer = (struct PeerData*) cls; |
819 | 819 | ||
820 | GNUNET_SCALARPRODUCT_disconnect (peer->vh); | 820 | GNUNET_SCALARPRODUCT_cancel (peer->vh); |
821 | return; | 821 | return; |
822 | 822 | ||
823 | GNUNET_assert (0); | 823 | GNUNET_assert (0); |
diff --git a/src/scalarproduct/test_scalarproduct_api_regression.c b/src/scalarproduct/test_scalarproduct_api_regression.c index c5170862e..391fa483a 100644 --- a/src/scalarproduct/test_scalarproduct_api_regression.c +++ b/src/scalarproduct/test_scalarproduct_api_regression.c | |||
@@ -655,7 +655,7 @@ scalarproduct_da (void *cls, void *op_result) | |||
655 | { | 655 | { |
656 | struct PeerData* peer = (struct PeerData*) cls; | 656 | struct PeerData* peer = (struct PeerData*) cls; |
657 | 657 | ||
658 | GNUNET_SCALARPRODUCT_disconnect (peer->vh); | 658 | GNUNET_SCALARPRODUCT_cancel (peer->vh); |
659 | peer->vh = NULL; | 659 | peer->vh = NULL; |
660 | return; | 660 | return; |
661 | } | 661 | } |
diff --git a/src/scalarproduct/test_scalarproduct_api_regression2.c b/src/scalarproduct/test_scalarproduct_api_regression2.c index 7fb4e0c01..24d7e9057 100644 --- a/src/scalarproduct/test_scalarproduct_api_regression2.c +++ b/src/scalarproduct/test_scalarproduct_api_regression2.c | |||
@@ -741,7 +741,7 @@ scalarproduct_da (void *cls, void *op_result) | |||
741 | { | 741 | { |
742 | struct PeerData* peer = (struct PeerData*) cls; | 742 | struct PeerData* peer = (struct PeerData*) cls; |
743 | 743 | ||
744 | GNUNET_SCALARPRODUCT_disconnect (peer->vh); | 744 | GNUNET_SCALARPRODUCT_cancel (peer->vh); |
745 | return; | 745 | return; |
746 | } | 746 | } |
747 | 747 | ||