diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-10-18 12:40:28 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-10-18 12:40:28 +0000 |
commit | 0ef092ad9150a7424d2fe48abc35579eb3608b4b (patch) | |
tree | 6b429e383e4b506be3469ec94a8109a58d834436 /src/datastore | |
parent | d4a2f4ad4ef1e68cd92bcd138cfe2cd69a1cd5cc (diff) | |
download | gnunet-0ef092ad9150a7424d2fe48abc35579eb3608b4b.tar.gz gnunet-0ef092ad9150a7424d2fe48abc35579eb3608b4b.zip |
avoid disconnect on cancel
Diffstat (limited to 'src/datastore')
-rw-r--r-- | src/datastore/datastore_api.c | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/src/datastore/datastore_api.c b/src/datastore/datastore_api.c index a15bc183a..e0c184a57 100644 --- a/src/datastore/datastore_api.c +++ b/src/datastore/datastore_api.c | |||
@@ -159,7 +159,7 @@ struct GNUNET_DATASTORE_QueueEntry | |||
159 | * multiple of 64 bits. | 159 | * multiple of 64 bits. |
160 | */ | 160 | */ |
161 | int32_t was_transmitted; | 161 | int32_t was_transmitted; |
162 | 162 | ||
163 | }; | 163 | }; |
164 | 164 | ||
165 | /** | 165 | /** |
@@ -684,9 +684,10 @@ process_status_message (void *cls, | |||
684 | free_queue_entry (qe); | 684 | free_queue_entry (qe); |
685 | if (NULL == h->client) | 685 | if (NULL == h->client) |
686 | return; /* forced disconnect */ | 686 | return; /* forced disconnect */ |
687 | rc.cont (rc.cont_cls, | 687 | if (rc.cont != NULL) |
688 | GNUNET_SYSERR, | 688 | rc.cont (rc.cont_cls, |
689 | _("Failed to receive response from database.")); | 689 | GNUNET_SYSERR, |
690 | _("Failed to receive status response from database.")); | ||
690 | if (was_transmitted == GNUNET_YES) | 691 | if (was_transmitted == GNUNET_YES) |
691 | do_disconnect (h); | 692 | do_disconnect (h); |
692 | return; | 693 | return; |
@@ -700,9 +701,10 @@ process_status_message (void *cls, | |||
700 | GNUNET_break (0); | 701 | GNUNET_break (0); |
701 | h->retry_time = GNUNET_TIME_UNIT_ZERO; | 702 | h->retry_time = GNUNET_TIME_UNIT_ZERO; |
702 | do_disconnect (h); | 703 | do_disconnect (h); |
703 | rc.cont (rc.cont_cls, | 704 | if (rc.cont != NULL) |
704 | GNUNET_SYSERR, | 705 | rc.cont (rc.cont_cls, |
705 | _("Error reading response from datastore service")); | 706 | GNUNET_SYSERR, |
707 | _("Error reading response from datastore service")); | ||
706 | return; | 708 | return; |
707 | } | 709 | } |
708 | sm = (const struct StatusMessage*) msg; | 710 | sm = (const struct StatusMessage*) msg; |
@@ -730,9 +732,10 @@ process_status_message (void *cls, | |||
730 | emsg); | 732 | emsg); |
731 | #endif | 733 | #endif |
732 | process_queue (h); | 734 | process_queue (h); |
733 | rc.cont (rc.cont_cls, | 735 | if (rc.cont != NULL) |
734 | status, | 736 | rc.cont (rc.cont_cls, |
735 | emsg); | 737 | status, |
738 | emsg); | ||
736 | } | 739 | } |
737 | 740 | ||
738 | 741 | ||
@@ -1384,20 +1387,15 @@ GNUNET_DATASTORE_cancel (struct GNUNET_DATASTORE_QueueEntry *qe) | |||
1384 | qe->qc.rc.iter = NULL; | 1387 | qe->qc.rc.iter = NULL; |
1385 | if (GNUNET_YES != h->in_receive) | 1388 | if (GNUNET_YES != h->in_receive) |
1386 | GNUNET_DATASTORE_get_next (h, GNUNET_YES); | 1389 | GNUNET_DATASTORE_get_next (h, GNUNET_YES); |
1387 | return; | ||
1388 | } | 1390 | } |
1389 | reconnect = GNUNET_YES; | 1391 | else |
1392 | { | ||
1393 | qe->qc.sc.cont = NULL; | ||
1394 | } | ||
1395 | return; | ||
1390 | } | 1396 | } |
1391 | free_queue_entry (qe); | 1397 | free_queue_entry (qe); |
1392 | if (reconnect) | 1398 | process_queue (h); |
1393 | { | ||
1394 | h->retry_time = GNUNET_TIME_UNIT_ZERO; | ||
1395 | do_disconnect (h); | ||
1396 | } | ||
1397 | else | ||
1398 | { | ||
1399 | process_queue (h); | ||
1400 | } | ||
1401 | } | 1399 | } |
1402 | 1400 | ||
1403 | 1401 | ||