diff options
Diffstat (limited to 'src/util/client.c')
-rw-r--r-- | src/util/client.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/util/client.c b/src/util/client.c index 30c0fcf86..86b36bfbb 100644 --- a/src/util/client.c +++ b/src/util/client.c | |||
@@ -350,14 +350,18 @@ GNUNET_CLIENT_ignore_shutdown (struct GNUNET_CLIENT_Connection *h, | |||
350 | * *NOT* be called, not even with a NULL message). Any pending | 350 | * *NOT* be called, not even with a NULL message). Any pending |
351 | * transmission request will also be cancelled UNLESS the callback for | 351 | * transmission request will also be cancelled UNLESS the callback for |
352 | * the transmission request has already been called, in which case the | 352 | * the transmission request has already been called, in which case the |
353 | * transmission is guaranteed to complete before the socket is fully | 353 | * transmission 'finish_pending_write' argument determines whether or |
354 | * destroyed (unless, of course, there is an error with the server | 354 | * not the write is guaranteed to complete before the socket is fully |
355 | * in which case the message may still be lost). | 355 | * destroyed (unless, of course, there is an error with the server in |
356 | * which case the message may still be lost). | ||
356 | * | 357 | * |
358 | * @param finish_pending_write should a transmission already passed to the | ||
359 | * handle be completed? | ||
357 | * @param sock handle to the service connection | 360 | * @param sock handle to the service connection |
358 | */ | 361 | */ |
359 | void | 362 | void |
360 | GNUNET_CLIENT_disconnect (struct GNUNET_CLIENT_Connection *sock) | 363 | GNUNET_CLIENT_disconnect (struct GNUNET_CLIENT_Connection *sock, |
364 | int finish_pending_write) | ||
361 | { | 365 | { |
362 | GNUNET_assert (sock->sock != NULL); | 366 | GNUNET_assert (sock->sock != NULL); |
363 | if (sock->in_receive == GNUNET_YES) | 367 | if (sock->in_receive == GNUNET_YES) |
@@ -365,7 +369,7 @@ GNUNET_CLIENT_disconnect (struct GNUNET_CLIENT_Connection *sock) | |||
365 | GNUNET_CONNECTION_receive_cancel (sock->sock); | 369 | GNUNET_CONNECTION_receive_cancel (sock->sock); |
366 | sock->in_receive = GNUNET_NO; | 370 | sock->in_receive = GNUNET_NO; |
367 | } | 371 | } |
368 | GNUNET_CONNECTION_destroy (sock->sock); | 372 | GNUNET_CONNECTION_destroy (sock->sock, finish_pending_write); |
369 | sock->sock = NULL; | 373 | sock->sock = NULL; |
370 | if (sock->tag != NULL) | 374 | if (sock->tag != NULL) |
371 | { | 375 | { |
@@ -551,7 +555,7 @@ write_shutdown (void *cls, size_t size, void *buf) | |||
551 | struct GNUNET_MessageHeader *msg; | 555 | struct GNUNET_MessageHeader *msg; |
552 | struct GNUNET_CLIENT_Connection *sock = cls; | 556 | struct GNUNET_CLIENT_Connection *sock = cls; |
553 | 557 | ||
554 | GNUNET_CLIENT_disconnect (sock); | 558 | GNUNET_CLIENT_disconnect (sock, GNUNET_YES); |
555 | if (size < sizeof (struct GNUNET_MessageHeader)) | 559 | if (size < sizeof (struct GNUNET_MessageHeader)) |
556 | { | 560 | { |
557 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 561 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
@@ -627,7 +631,7 @@ confirm_handler (void *cls, const struct GNUNET_MessageHeader *msg) | |||
627 | { | 631 | { |
628 | service_test_error (conn->sched, conn->test_cb, conn->test_cb_cls); | 632 | service_test_error (conn->sched, conn->test_cb, conn->test_cb_cls); |
629 | } | 633 | } |
630 | GNUNET_CLIENT_disconnect (conn); | 634 | GNUNET_CLIENT_disconnect (conn, GNUNET_NO); |
631 | } | 635 | } |
632 | 636 | ||
633 | 637 | ||
@@ -710,7 +714,7 @@ GNUNET_CLIENT_service_test (struct GNUNET_SCHEDULER_Handle *sched, | |||
710 | _("Failure to transmit request to service `%s'\n"), | 714 | _("Failure to transmit request to service `%s'\n"), |
711 | service); | 715 | service); |
712 | service_test_error (sched, task, task_cls); | 716 | service_test_error (sched, task, task_cls); |
713 | GNUNET_CLIENT_disconnect (conn); | 717 | GNUNET_CLIENT_disconnect (conn, GNUNET_NO); |
714 | return; | 718 | return; |
715 | } | 719 | } |
716 | } | 720 | } |
@@ -806,7 +810,7 @@ client_notify (void *cls, size_t size, void *buf) | |||
806 | return 0; | 810 | return 0; |
807 | } | 811 | } |
808 | /* auto-retry */ | 812 | /* auto-retry */ |
809 | GNUNET_CONNECTION_destroy (th->sock->sock); | 813 | GNUNET_CONNECTION_destroy (th->sock->sock, GNUNET_NO); |
810 | th->sock->sock = do_connect (th->sock->sched, | 814 | th->sock->sock = do_connect (th->sock->sched, |
811 | th->sock->service_name, th->sock->cfg); | 815 | th->sock->service_name, th->sock->cfg); |
812 | GNUNET_assert (NULL != th->sock->sock); | 816 | GNUNET_assert (NULL != th->sock->sock); |