aboutsummaryrefslogtreecommitdiff
path: root/src/core/core_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-06-17 15:39:23 +0000
committerChristian Grothoff <christian@grothoff.org>2011-06-17 15:39:23 +0000
commitce4ebee5643eeff8ba5888247205bb8426ccf362 (patch)
tree24c9a4713e4ca4e7dd2c73340f9185c9f37f8bfa /src/core/core_api.c
parentb90fdb9329d445cb2829205cc134b06689f1fe7b (diff)
downloadgnunet-ce4ebee5643eeff8ba5888247205bb8426ccf362.tar.gz
gnunet-ce4ebee5643eeff8ba5888247205bb8426ccf362.zip
more error checks
Diffstat (limited to 'src/core/core_api.c')
-rw-r--r--src/core/core_api.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/core/core_api.c b/src/core/core_api.c
index 5b90a11ed..af46c6e63 100644
--- a/src/core/core_api.c
+++ b/src/core/core_api.c
@@ -417,17 +417,6 @@ disconnect_and_free_peer_entry (void *cls,
417 GNUNET_CORE_PeerConfigurationInfoCallback pcic; 417 GNUNET_CORE_PeerConfigurationInfoCallback pcic;
418 void *pcic_cls; 418 void *pcic_cls;
419 419
420 if (NULL != (pcic = pr->pcic))
421 {
422 pcic_cls = pr->pcic_cls;
423 GNUNET_CORE_peer_change_preference_cancel (pr->pcic_ptr);
424 pcic (pcic_cls,
425 &pr->peer,
426 zero,
427 0,
428 GNUNET_TIME_UNIT_FOREVER_REL,
429 0);
430 }
431 if (pr->timeout_task != GNUNET_SCHEDULER_NO_TASK) 420 if (pr->timeout_task != GNUNET_SCHEDULER_NO_TASK)
432 { 421 {
433 GNUNET_SCHEDULER_cancel (pr->timeout_task); 422 GNUNET_SCHEDULER_cancel (pr->timeout_task);
@@ -449,6 +438,18 @@ disconnect_and_free_peer_entry (void *cls,
449 &pr->peer); 438 &pr->peer);
450 /* all requests should have been cancelled, clean up anyway, just in case */ 439 /* all requests should have been cancelled, clean up anyway, just in case */
451 GNUNET_break (pr->queue_size == 0); 440 GNUNET_break (pr->queue_size == 0);
441 if (NULL != (pcic = pr->pcic))
442 {
443 GNUNET_break (0);
444 pcic_cls = pr->pcic_cls;
445 GNUNET_CORE_peer_change_preference_cancel (pr->pcic_ptr);
446 pcic (pcic_cls,
447 &pr->peer,
448 zero,
449 0,
450 GNUNET_TIME_UNIT_FOREVER_REL,
451 0);
452 }
452 while (NULL != (th = pr->pending_head)) 453 while (NULL != (th = pr->pending_head))
453 { 454 {
454 GNUNET_break (0); 455 GNUNET_break (0);
@@ -460,6 +461,7 @@ disconnect_and_free_peer_entry (void *cls,
460 th->cm->th = NULL; 461 th->cm->th = NULL;
461 GNUNET_free (th); 462 GNUNET_free (th);
462 } 463 }
464 /* done with 'voluntary' cleanups, now on to normal freeing */
463 GNUNET_assert (GNUNET_YES == 465 GNUNET_assert (GNUNET_YES ==
464 GNUNET_CONTAINER_multihashmap_remove (h->peers, 466 GNUNET_CONTAINER_multihashmap_remove (h->peers,
465 key, 467 key,
@@ -1512,6 +1514,7 @@ GNUNET_CORE_disconnect (struct GNUNET_CORE_Handle *handle)
1512 handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK; 1514 handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK;
1513 } 1515 }
1514 GNUNET_CONTAINER_multihashmap_destroy (handle->peers); 1516 GNUNET_CONTAINER_multihashmap_destroy (handle->peers);
1517 handle->peers = NULL;
1515 GNUNET_break (handle->ready_peer_head == NULL); 1518 GNUNET_break (handle->ready_peer_head == NULL);
1516 GNUNET_free (handle); 1519 GNUNET_free (handle);
1517} 1520}
@@ -1942,7 +1945,7 @@ GNUNET_CORE_peer_change_preference (struct GNUNET_CORE_Handle *h,
1942 if (NULL == pr) 1945 if (NULL == pr)
1943 { 1946 {
1944 /* attempt to change preference on peer that is not connected */ 1947 /* attempt to change preference on peer that is not connected */
1945 GNUNET_break (0); 1948 GNUNET_assert (0);
1946 return NULL; 1949 return NULL;
1947 } 1950 }
1948 if (pr->pcic != NULL) 1951 if (pr->pcic != NULL)