diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-12-07 17:18:53 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-12-07 17:18:53 +0000 |
commit | 0bb2e2d462b67cc2c6372de8b524f23245ab8926 (patch) | |
tree | 75f7d41651b2583166e6334f5089dbb83cf2e0f3 /src/dv/gnunet-service-dv.c | |
parent | 811e9e592ec037114b016889609f59d19f414011 (diff) | |
download | gnunet-0bb2e2d462b67cc2c6372de8b524f23245ab8926.tar.gz gnunet-0bb2e2d462b67cc2c6372de8b524f23245ab8926.zip |
fixes for DV with new transport distance and core changes over the past few weeks
Diffstat (limited to 'src/dv/gnunet-service-dv.c')
-rw-r--r-- | src/dv/gnunet-service-dv.c | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/src/dv/gnunet-service-dv.c b/src/dv/gnunet-service-dv.c index 78e63facc..28362b82f 100644 --- a/src/dv/gnunet-service-dv.c +++ b/src/dv/gnunet-service-dv.c | |||
@@ -855,7 +855,7 @@ size_t core_transmit_notify (void *cls, | |||
855 | */ | 855 | */ |
856 | static void | 856 | static void |
857 | try_core_send (void *cls, | 857 | try_core_send (void *cls, |
858 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 858 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
859 | { | 859 | { |
860 | struct PendingMessage *pending; | 860 | struct PendingMessage *pending; |
861 | pending = core_pending_head; | 861 | pending = core_pending_head; |
@@ -863,8 +863,8 @@ try_core_send (void *cls, | |||
863 | if (core_transmit_handle != NULL) | 863 | if (core_transmit_handle != NULL) |
864 | return; /* Message send already in progress */ | 864 | return; /* Message send already in progress */ |
865 | 865 | ||
866 | if (pending != NULL) | 866 | if ((pending != NULL) && (coreAPI != NULL)) |
867 | core_transmit_handle = GNUNET_CORE_notify_transmit_ready(coreAPI, pending->importance, pending->timeout, &pending->recipient, pending->msg_size, &core_transmit_notify, NULL); | 867 | core_transmit_handle = GNUNET_CORE_notify_transmit_ready (coreAPI, pending->importance, pending->timeout, &pending->recipient, pending->msg_size, &core_transmit_notify, NULL); |
868 | } | 868 | } |
869 | 869 | ||
870 | /** | 870 | /** |
@@ -1440,8 +1440,6 @@ handle_dv_data_message (void *cls, | |||
1440 | pos = pos->next; | 1440 | pos = pos->next; |
1441 | } | 1441 | } |
1442 | #endif | 1442 | #endif |
1443 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
1444 | "%s: unknown sender (%u), Message uid %u from %s!\n", my_short_id, ntohl(incoming->sender), ntohl(incoming->uid), GNUNET_i2s(&dn->identity)); | ||
1445 | 1443 | ||
1446 | found_pos = -1; | 1444 | found_pos = -1; |
1447 | for (i = 0; i< MAX_OUTSTANDING_MESSAGES; i++) | 1445 | for (i = 0; i< MAX_OUTSTANDING_MESSAGES; i++) |
@@ -2148,6 +2146,7 @@ shutdown_task (void *cls, | |||
2148 | GNUNET_CONTAINER_heap_destroy(neighbor_min_heap); | 2146 | GNUNET_CONTAINER_heap_destroy(neighbor_min_heap); |
2149 | 2147 | ||
2150 | GNUNET_CORE_disconnect (coreAPI); | 2148 | GNUNET_CORE_disconnect (coreAPI); |
2149 | coreAPI = NULL; | ||
2151 | GNUNET_PEERINFO_disconnect(peerinfo_handle); | 2150 | GNUNET_PEERINFO_disconnect(peerinfo_handle); |
2152 | GNUNET_SERVER_mst_destroy(coreMST); | 2151 | GNUNET_SERVER_mst_destroy(coreMST); |
2153 | GNUNET_free_non_null(my_short_id); | 2152 | GNUNET_free_non_null(my_short_id); |
@@ -2963,6 +2962,7 @@ void handle_core_disconnect (void *cls, | |||
2963 | struct DistantNeighbor *referee; | 2962 | struct DistantNeighbor *referee; |
2964 | struct FindDestinationContext fdc; | 2963 | struct FindDestinationContext fdc; |
2965 | struct DisconnectContext disconnect_context; | 2964 | struct DisconnectContext disconnect_context; |
2965 | struct PendingMessage *pending_pos; | ||
2966 | 2966 | ||
2967 | #if DEBUG_DV | 2967 | #if DEBUG_DV |
2968 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2968 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -2971,10 +2971,24 @@ void handle_core_disconnect (void *cls, | |||
2971 | 2971 | ||
2972 | neighbor = | 2972 | neighbor = |
2973 | GNUNET_CONTAINER_multihashmap_get (direct_neighbors, &peer->hashPubKey); | 2973 | GNUNET_CONTAINER_multihashmap_get (direct_neighbors, &peer->hashPubKey); |
2974 | |||
2974 | if (neighbor == NULL) | 2975 | if (neighbor == NULL) |
2975 | { | 2976 | { |
2976 | return; | 2977 | return; |
2977 | } | 2978 | } |
2979 | |||
2980 | pending_pos = core_pending_head; | ||
2981 | while (NULL != pending_pos) | ||
2982 | { | ||
2983 | if (0 == memcmp(&pending_pos->recipient, &neighbor->identity, sizeof(struct GNUNET_PeerIdentity))) | ||
2984 | { | ||
2985 | GNUNET_CONTAINER_DLL_remove(core_pending_head, core_pending_tail, pending_pos); | ||
2986 | pending_pos = core_pending_head; | ||
2987 | } | ||
2988 | else | ||
2989 | pending_pos = pending_pos->next; | ||
2990 | } | ||
2991 | |||
2978 | while (NULL != (referee = neighbor->referee_head)) | 2992 | while (NULL != (referee = neighbor->referee_head)) |
2979 | distant_neighbor_free (referee); | 2993 | distant_neighbor_free (referee); |
2980 | 2994 | ||
@@ -2992,11 +3006,12 @@ void handle_core_disconnect (void *cls, | |||
2992 | 3006 | ||
2993 | GNUNET_assert (neighbor->referee_tail == NULL); | 3007 | GNUNET_assert (neighbor->referee_tail == NULL); |
2994 | if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_remove (direct_neighbors, | 3008 | if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_remove (direct_neighbors, |
2995 | &peer->hashPubKey, neighbor)) | 3009 | &peer->hashPubKey, neighbor)) |
2996 | { | 3010 | { |
2997 | GNUNET_break(0); | 3011 | GNUNET_break(0); |
2998 | } | 3012 | } |
2999 | if ((neighbor->send_context != NULL) && (neighbor->send_context->task != GNUNET_SCHEDULER_NO_TASK)) | 3013 | if ((neighbor->send_context != NULL) && |
3014 | (neighbor->send_context->task != GNUNET_SCHEDULER_NO_TASK)) | ||
3000 | GNUNET_SCHEDULER_cancel(neighbor->send_context->task); | 3015 | GNUNET_SCHEDULER_cancel(neighbor->send_context->task); |
3001 | GNUNET_free (neighbor); | 3016 | GNUNET_free (neighbor); |
3002 | } | 3017 | } |
@@ -3072,8 +3087,8 @@ run (void *cls, | |||
3072 | 3087 | ||
3073 | /* Scheduled the task to clean up when shutdown is called */ | 3088 | /* Scheduled the task to clean up when shutdown is called */ |
3074 | cleanup_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, | 3089 | cleanup_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, |
3075 | &shutdown_task, | 3090 | &shutdown_task, |
3076 | NULL); | 3091 | NULL); |
3077 | } | 3092 | } |
3078 | 3093 | ||
3079 | 3094 | ||