diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-09-29 15:14:47 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-09-29 15:14:47 +0000 |
commit | 7083417685778766737d424bd2da05fd6a255fa8 (patch) | |
tree | 2c7bfcb11d98d885ce01a1f31c2a3b4599d78321 /src/namestore/namestore_api.c | |
parent | 3c7b96221206c247d1ca1f2da4996f103e2df712 (diff) | |
download | gnunet-7083417685778766737d424bd2da05fd6a255fa8.tar.gz gnunet-7083417685778766737d424bd2da05fd6a255fa8.zip |
-disconnect on protocol errors, not on no-result
Diffstat (limited to 'src/namestore/namestore_api.c')
-rw-r--r-- | src/namestore/namestore_api.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c index 946dd91c7..bc58f3760 100644 --- a/src/namestore/namestore_api.c +++ b/src/namestore/namestore_api.c | |||
@@ -452,13 +452,16 @@ handle_zone_to_name_response (struct GNUNET_NAMESTORE_QueueEntry *qe, | |||
452 | switch (res) | 452 | switch (res) |
453 | { | 453 | { |
454 | case GNUNET_SYSERR: | 454 | case GNUNET_SYSERR: |
455 | LOG (GNUNET_ERROR_TYPE_DEBUG, "An error occured during zone to name operation\n"); | 455 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
456 | "An error occured during zone to name operation\n"); | ||
456 | break; | 457 | break; |
457 | case GNUNET_NO: | 458 | case GNUNET_NO: |
458 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Namestore has no result for zone to name mapping \n"); | 459 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
460 | "Namestore has no result for zone to name mapping \n"); | ||
459 | break; | 461 | break; |
460 | case GNUNET_YES: | 462 | case GNUNET_YES: |
461 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Namestore has result for zone to name mapping \n"); | 463 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
464 | "Namestore has result for zone to name mapping \n"); | ||
462 | name_len = ntohs (msg->name_len); | 465 | name_len = ntohs (msg->name_len); |
463 | rd_count = ntohs (msg->rd_count); | 466 | rd_count = ntohs (msg->rd_count); |
464 | rd_ser_len = ntohs (msg->rd_len); | 467 | rd_ser_len = ntohs (msg->rd_len); |
@@ -472,6 +475,7 @@ handle_zone_to_name_response (struct GNUNET_NAMESTORE_QueueEntry *qe, | |||
472 | rd_tmp = &name_tmp[name_len]; | 475 | rd_tmp = &name_tmp[name_len]; |
473 | { | 476 | { |
474 | struct GNUNET_NAMESTORE_RecordData rd[rd_count]; | 477 | struct GNUNET_NAMESTORE_RecordData rd[rd_count]; |
478 | |||
475 | if (GNUNET_OK != GNUNET_NAMESTORE_records_deserialize(rd_ser_len, rd_tmp, rd_count, rd)) | 479 | if (GNUNET_OK != GNUNET_NAMESTORE_records_deserialize(rd_ser_len, rd_tmp, rd_count, rd)) |
476 | { | 480 | { |
477 | GNUNET_break (0); | 481 | GNUNET_break (0); |
@@ -493,7 +497,7 @@ handle_zone_to_name_response (struct GNUNET_NAMESTORE_QueueEntry *qe, | |||
493 | /* error case, call continuation with error */ | 497 | /* error case, call continuation with error */ |
494 | if (NULL != qe->proc) | 498 | if (NULL != qe->proc) |
495 | qe->proc (qe->proc_cls, NULL, NULL, 0, NULL); | 499 | qe->proc (qe->proc_cls, NULL, NULL, 0, NULL); |
496 | return GNUNET_OK; | 500 | return GNUNET_NO; |
497 | } | 501 | } |
498 | 502 | ||
499 | 503 | ||
@@ -594,7 +598,8 @@ handle_zone_iteration_response (struct GNUNET_NAMESTORE_ZoneIterator *ze, | |||
594 | GNUNET_break (0); | 598 | GNUNET_break (0); |
595 | return GNUNET_SYSERR; | 599 | return GNUNET_SYSERR; |
596 | } | 600 | } |
597 | if ((0 == name_len) && (0 == (memcmp (&msg->private_key, &priv_dummy, sizeof (priv_dummy))))) | 601 | if ( (0 == name_len) && |
602 | (0 == (memcmp (&msg->private_key, &priv_dummy, sizeof (priv_dummy)))) ) | ||
598 | { | 603 | { |
599 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 604 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
600 | "Zone iteration is completed!\n"); | 605 | "Zone iteration is completed!\n"); |
@@ -706,12 +711,12 @@ process_namestore_message (void *cls, | |||
706 | if (NULL != qe) | 711 | if (NULL != qe) |
707 | { | 712 | { |
708 | ret = manage_record_operations (qe, msg, type, size); | 713 | ret = manage_record_operations (qe, msg, type, size); |
709 | if (GNUNET_OK != ret) | 714 | if (GNUNET_SYSERR == ret) |
710 | { | 715 | { |
711 | /* protocol error, need to reconnect */ | 716 | /* protocol error, need to reconnect */ |
712 | h->reconnect = GNUNET_YES; | 717 | h->reconnect = GNUNET_YES; |
713 | } | 718 | } |
714 | if (GNUNET_SYSERR != ret) | 719 | else |
715 | { | 720 | { |
716 | /* client was notified about success or failure, clean up 'qe' */ | 721 | /* client was notified about success or failure, clean up 'qe' */ |
717 | GNUNET_CONTAINER_DLL_remove (h->op_head, | 722 | GNUNET_CONTAINER_DLL_remove (h->op_head, |