diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-11-22 10:44:06 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-11-22 10:44:06 +0000 |
commit | b294756144c6946da593df870d61c2cc3a66a44f (patch) | |
tree | 4734f17a1dc08f260e60b6a0f26aabb2647b0a72 /src/core | |
parent | f1252a5b29869c7641c348514fe16d913b2d26ea (diff) | |
download | gnunet-b294756144c6946da593df870d61c2cc3a66a44f.tar.gz gnunet-b294756144c6946da593df870d61c2cc3a66a44f.zip |
possible fix for CORE_disconnect segfault, GNUNET_break instead of segfault in other error case (will see if this causes more troubles)
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/core_api.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/core/core_api.c b/src/core/core_api.c index abb7fbc63..48de0a214 100644 --- a/src/core/core_api.c +++ b/src/core/core_api.c | |||
@@ -479,6 +479,9 @@ reconnect_later (struct GNUNET_CORE_Handle *h) | |||
479 | { | 479 | { |
480 | GNUNET_CLIENT_disconnect (h->client, GNUNET_NO); | 480 | GNUNET_CLIENT_disconnect (h->client, GNUNET_NO); |
481 | h->client = NULL; | 481 | h->client = NULL; |
482 | /* FIXME: is this right? GNUNET_CLIENT_disconnect frees all outstanding transmission handles, so h->cth is invalid! */ | ||
483 | /* Otherwise a subsequent call to GNUNET_CORE_disconnect tries to cancel this task!!! */ | ||
484 | h->cth = NULL; | ||
482 | GNUNET_CONTAINER_multihashmap_iterate (h->peers, | 485 | GNUNET_CONTAINER_multihashmap_iterate (h->peers, |
483 | &disconnect_and_free_peer_entry, | 486 | &disconnect_and_free_peer_entry, |
484 | h); | 487 | h); |
@@ -1124,6 +1127,14 @@ main_notify_handler (void *cls, | |||
1124 | "Received notification about transmission readiness to `%s'.\n", | 1127 | "Received notification about transmission readiness to `%s'.\n", |
1125 | GNUNET_i2s (&smr->peer)); | 1128 | GNUNET_i2s (&smr->peer)); |
1126 | #endif | 1129 | #endif |
1130 | /* FIXME: pr->pending_head is sometimes NULL here... Safe to just return? Or does this indicate something is out of sync somewhere else? */ | ||
1131 | if (pr->pending_head == NULL) | ||
1132 | { | ||
1133 | GNUNET_break (0); | ||
1134 | reconnect_later (h); | ||
1135 | return; | ||
1136 | } | ||
1137 | |||
1127 | th = pr->pending_head; | 1138 | th = pr->pending_head; |
1128 | if (ntohs (smr->smr_id) != th->smr_id) | 1139 | if (ntohs (smr->smr_id) != th->smr_id) |
1129 | { | 1140 | { |
@@ -1365,7 +1376,7 @@ GNUNET_CORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1365 | /** | 1376 | /** |
1366 | * Disconnect from the core service. This function can only | 1377 | * Disconnect from the core service. This function can only |
1367 | * be called *after* all pending 'GNUNET_CORE_notify_transmit_ready' | 1378 | * be called *after* all pending 'GNUNET_CORE_notify_transmit_ready' |
1368 | * requests have been explicitly cancelled. | 1379 | * requests have been explicitly canceled. |
1369 | * | 1380 | * |
1370 | * @param handle connection to core to disconnect | 1381 | * @param handle connection to core to disconnect |
1371 | */ | 1382 | */ |