diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-05-09 18:41:51 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-05-09 18:41:51 +0000 |
commit | 1ff6491c4bfb2323237bc2af60ee6279e1f4167e (patch) | |
tree | 316c7802672f457ea14a9bfc98d41df1317c5dc1 /src/core | |
parent | 28095476f5a76b9483e3ecc9b9a3ab7ddd4ff54b (diff) | |
download | gnunet-1ff6491c4bfb2323237bc2af60ee6279e1f4167e.tar.gz gnunet-1ff6491c4bfb2323237bc2af60ee6279e1f4167e.zip |
-fixing #2332, plus some minor refactoring
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/core_api.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/core/core_api.c b/src/core/core_api.c index d6cb68213..b9c158ae3 100644 --- a/src/core/core_api.c +++ b/src/core/core_api.c | |||
@@ -576,6 +576,13 @@ transmission_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
576 | * us from the 'ready' list */ | 576 | * us from the 'ready' list */ |
577 | GNUNET_CONTAINER_DLL_remove (h->ready_peer_head, h->ready_peer_tail, pr); | 577 | GNUNET_CONTAINER_DLL_remove (h->ready_peer_head, h->ready_peer_tail, pr); |
578 | } | 578 | } |
579 | if (NULL != th->cm) | ||
580 | { | ||
581 | /* we're currently in the control queue, remove */ | ||
582 | GNUNET_CONTAINER_DLL_remove (h->control_pending_head, | ||
583 | h->control_pending_tail, th->cm); | ||
584 | GNUNET_free (th->cm); | ||
585 | } | ||
579 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 586 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
580 | "Signalling timeout of request for transmission to CORE service\n"); | 587 | "Signalling timeout of request for transmission to CORE service\n"); |
581 | request_next_transmission (pr); | 588 | request_next_transmission (pr); |
@@ -1225,7 +1232,7 @@ GNUNET_CORE_disconnect (struct GNUNET_CORE_Handle *handle) | |||
1225 | struct ControlMessage *cm; | 1232 | struct ControlMessage *cm; |
1226 | 1233 | ||
1227 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from CORE service\n"); | 1234 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Disconnecting from CORE service\n"); |
1228 | if (handle->cth != NULL) | 1235 | if (NULL != handle->cth) |
1229 | { | 1236 | { |
1230 | GNUNET_CLIENT_notify_transmit_ready_cancel (handle->cth); | 1237 | GNUNET_CLIENT_notify_transmit_ready_cancel (handle->cth); |
1231 | handle->cth = NULL; | 1238 | handle->cth = NULL; |
@@ -1234,13 +1241,13 @@ GNUNET_CORE_disconnect (struct GNUNET_CORE_Handle *handle) | |||
1234 | { | 1241 | { |
1235 | GNUNET_CONTAINER_DLL_remove (handle->control_pending_head, | 1242 | GNUNET_CONTAINER_DLL_remove (handle->control_pending_head, |
1236 | handle->control_pending_tail, cm); | 1243 | handle->control_pending_tail, cm); |
1237 | if (cm->th != NULL) | 1244 | if (NULL != cm->th) |
1238 | cm->th->cm = NULL; | 1245 | cm->th->cm = NULL; |
1239 | if (cm->cont != NULL) | 1246 | if (NULL != cm->cont) |
1240 | cm->cont (cm->cont_cls, GNUNET_SYSERR); | 1247 | cm->cont (cm->cont_cls, GNUNET_SYSERR); |
1241 | GNUNET_free (cm); | 1248 | GNUNET_free (cm); |
1242 | } | 1249 | } |
1243 | if (handle->client != NULL) | 1250 | if (NULL != handle->client) |
1244 | { | 1251 | { |
1245 | GNUNET_CLIENT_disconnect (handle->client); | 1252 | GNUNET_CLIENT_disconnect (handle->client); |
1246 | handle->client = NULL; | 1253 | handle->client = NULL; |
@@ -1374,7 +1381,7 @@ GNUNET_CORE_notify_transmit_ready (struct GNUNET_CORE_Handle *handle, int cork, | |||
1374 | 1381 | ||
1375 | /* insertion sort */ | 1382 | /* insertion sort */ |
1376 | prev = pos; | 1383 | prev = pos; |
1377 | while ((pos != NULL) && (pos->timeout.abs_value < th->timeout.abs_value)) | 1384 | while ((NULL != pos) && (pos->timeout.abs_value < th->timeout.abs_value)) |
1378 | { | 1385 | { |
1379 | prev = pos; | 1386 | prev = pos; |
1380 | pos = pos->next; | 1387 | pos = pos->next; |
@@ -1408,7 +1415,7 @@ GNUNET_CORE_notify_transmit_ready_cancel (struct GNUNET_CORE_TransmitHandle *th) | |||
1408 | was_head = (pr->pending_head == th); | 1415 | was_head = (pr->pending_head == th); |
1409 | GNUNET_CONTAINER_DLL_remove (pr->pending_head, pr->pending_tail, th); | 1416 | GNUNET_CONTAINER_DLL_remove (pr->pending_head, pr->pending_tail, th); |
1410 | pr->queue_size--; | 1417 | pr->queue_size--; |
1411 | if (th->cm != NULL) | 1418 | if (NULL != th->cm) |
1412 | { | 1419 | { |
1413 | /* we're currently in the control queue, remove */ | 1420 | /* we're currently in the control queue, remove */ |
1414 | GNUNET_CONTAINER_DLL_remove (h->control_pending_head, | 1421 | GNUNET_CONTAINER_DLL_remove (h->control_pending_head, |
@@ -1418,7 +1425,7 @@ GNUNET_CORE_notify_transmit_ready_cancel (struct GNUNET_CORE_TransmitHandle *th) | |||
1418 | GNUNET_free (th); | 1425 | GNUNET_free (th); |
1419 | if (was_head) | 1426 | if (was_head) |
1420 | { | 1427 | { |
1421 | if ((pr->prev != NULL) || (pr->next != NULL) || (pr == h->ready_peer_head)) | 1428 | if ((NULL != pr->prev) || (NULL != pr->next) || (pr == h->ready_peer_head)) |
1422 | { | 1429 | { |
1423 | /* the request that was 'approved' by core was | 1430 | /* the request that was 'approved' by core was |
1424 | * canceled before it could be transmitted; remove | 1431 | * canceled before it could be transmitted; remove |