aboutsummaryrefslogtreecommitdiff
path: root/src/namestore
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-09-29 15:14:47 +0000
committerChristian Grothoff <christian@grothoff.org>2013-09-29 15:14:47 +0000
commit7083417685778766737d424bd2da05fd6a255fa8 (patch)
tree2c7bfcb11d98d885ce01a1f31c2a3b4599d78321 /src/namestore
parent3c7b96221206c247d1ca1f2da4996f103e2df712 (diff)
downloadgnunet-7083417685778766737d424bd2da05fd6a255fa8.tar.gz
gnunet-7083417685778766737d424bd2da05fd6a255fa8.zip
-disconnect on protocol errors, not on no-result
Diffstat (limited to 'src/namestore')
-rw-r--r--src/namestore/gnunet-service-namestore.c2
-rw-r--r--src/namestore/namestore_api.c19
2 files changed, 13 insertions, 8 deletions
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c
index f113040b5..e42591b61 100644
--- a/src/namestore/gnunet-service-namestore.c
+++ b/src/namestore/gnunet-service-namestore.c
@@ -349,7 +349,7 @@ struct LookupBlockContext
349/** 349/**
350 * A #GNUNET_NAMESTORE_BlockCallback for name lookups in #handle_lookup_block 350 * A #GNUNET_NAMESTORE_BlockCallback for name lookups in #handle_lookup_block
351 * 351 *
352 * @param cls a 'struct LookupNameContext *' with information about the request 352 * @param cls a `struct LookupNameContext *` with information about the request
353 * @param block the block 353 * @param block the block
354 */ 354 */
355static void 355static void
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,