gnunet-service-dv.c | gnunet-service-dv.c | |||
---|---|---|---|---|
skipping to change at line 582 | skipping to change at line 582 | |||
*/ | */ | |||
static GNUNET_SCHEDULER_TaskIdentifier cleanup_task; | static GNUNET_SCHEDULER_TaskIdentifier cleanup_task; | |||
static size_t default_dv_priority = 0; | static size_t default_dv_priority = 0; | |||
static char *my_short_id; | static char *my_short_id; | |||
/** | /** | |||
* Transmit handle to the plugin. | * Transmit handle to the plugin. | |||
*/ | */ | |||
static struct GNUNET_CONNECTION_TransmitHandle *plugin_transmit_handle; | static struct GNUNET_SERVER_TransmitHandle *plugin_transmit_handle; | |||
/** | /** | |||
* Head of DLL for client messages | * Head of DLL for client messages | |||
*/ | */ | |||
static struct PendingMessage *plugin_pending_head; | static struct PendingMessage *plugin_pending_head; | |||
/** | /** | |||
* Tail of DLL for client messages | * Tail of DLL for client messages | |||
*/ | */ | |||
static struct PendingMessage *plugin_pending_tail; | static struct PendingMessage *plugin_pending_tail; | |||
skipping to change at line 1284 | skipping to change at line 1284 | |||
#endif | #endif | |||
/** | /** | |||
* Handler for messages parsed out by the tokenizer from | * Handler for messages parsed out by the tokenizer from | |||
* DV DATA received for this peer. | * DV DATA received for this peer. | |||
* | * | |||
* @param cls NULL | * @param cls NULL | |||
* @param client the TokenizedMessageContext which contains message informa tion | * @param client the TokenizedMessageContext which contains message informa tion | |||
* @param message the actual message | * @param message the actual message | |||
*/ | */ | |||
void | int | |||
tokenized_message_handler (void *cls, void *client, | tokenized_message_handler (void *cls, void *client, | |||
const struct GNUNET_MessageHeader *message) | const struct GNUNET_MessageHeader *message) | |||
{ | { | |||
struct TokenizedMessageContext *ctx = client; | struct TokenizedMessageContext *ctx = client; | |||
GNUNET_break_op (ntohs (message->type) != GNUNET_MESSAGE_TYPE_DV_GOSSIP); | GNUNET_break_op (ntohs (message->type) != GNUNET_MESSAGE_TYPE_DV_GOSSIP); | |||
GNUNET_break_op (ntohs (message->type) != GNUNET_MESSAGE_TYPE_DV_DATA); | GNUNET_break_op (ntohs (message->type) != GNUNET_MESSAGE_TYPE_DV_DATA); | |||
if ((ntohs (message->type) != GNUNET_MESSAGE_TYPE_DV_GOSSIP) && | if ((ntohs (message->type) != GNUNET_MESSAGE_TYPE_DV_GOSSIP) && | |||
(ntohs (message->type) != GNUNET_MESSAGE_TYPE_DV_DATA)) | (ntohs (message->type) != GNUNET_MESSAGE_TYPE_DV_DATA)) | |||
{ | { | |||
skipping to change at line 1308 | skipping to change at line 1308 | |||
my_short_id, "DV DATA", ctx->uid, ntohs (message->size), | my_short_id, "DV DATA", ctx->uid, ntohs (message->size), | |||
ntohs (message->type), ctx->distant->cost, | ntohs (message->type), ctx->distant->cost, | |||
GNUNET_i2s (&ctx->distant->identity)); | GNUNET_i2s (&ctx->distant->identity)); | |||
#endif | #endif | |||
GNUNET_assert (memcmp | GNUNET_assert (memcmp | |||
(ctx->peer, &ctx->distant->identity, | (ctx->peer, &ctx->distant->identity, | |||
sizeof (struct GNUNET_PeerIdentity)) != 0); | sizeof (struct GNUNET_PeerIdentity)) != 0); | |||
send_to_plugin (ctx->peer, message, ntohs (message->size), | send_to_plugin (ctx->peer, message, ntohs (message->size), | |||
&ctx->distant->identity, ctx->distant->cost); | &ctx->distant->identity, ctx->distant->cost); | |||
} | } | |||
return GNUNET_OK; | ||||
} | } | |||
#if DELAY_FORWARDS | #if DELAY_FORWARDS | |||
struct DelayedMessageContext | struct DelayedMessageContext | |||
{ | { | |||
struct GNUNET_PeerIdentity dest; | struct GNUNET_PeerIdentity dest; | |||
struct GNUNET_PeerIdentity sender; | struct GNUNET_PeerIdentity sender; | |||
struct GNUNET_MessageHeader *message; | struct GNUNET_MessageHeader *message; | |||
size_t message_size; | size_t message_size; | |||
uint32_t uid; | uint32_t uid; | |||
skipping to change at line 1329 | skipping to change at line 1330 | |||
void | void | |||
send_message_delayed (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | send_message_delayed (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
{ | { | |||
struct DelayedMessageContext *msg_ctx = cls; | struct DelayedMessageContext *msg_ctx = cls; | |||
if (msg_ctx != NULL) | if (msg_ctx != NULL) | |||
{ | { | |||
send_message (&msg_ctx->dest, &msg_ctx->sender, NULL, msg_ctx->message, | send_message (&msg_ctx->dest, &msg_ctx->sender, NULL, msg_ctx->message, | |||
msg_ctx->message_size, default_dv_priority, msg_ctx->uid, | msg_ctx->message_size, default_dv_priority, msg_ctx->uid, | |||
GNUNET_TIME_relative_get_forever ()); | GNUNET_TIME_UNIT_FOREVER_REL); | |||
GNUNET_free (msg_ctx->message); | GNUNET_free (msg_ctx->message); | |||
GNUNET_free (msg_ctx); | GNUNET_free (msg_ctx); | |||
} | } | |||
} | } | |||
#endif | #endif | |||
/** | /** | |||
* Get distance information from 'atsi'. | * Get distance information from 'atsi'. | |||
* | * | |||
* @param atsi performance data | * @param atsi performance data | |||
skipping to change at line 1624 | skipping to change at line 1625 | |||
&send_message_delayed, delayed_context); | &send_message_delayed, delayed_context); | |||
return GNUNET_OK; | return GNUNET_OK; | |||
} | } | |||
else | else | |||
#endif | #endif | |||
{ | { | |||
ret = | ret = | |||
send_message (destination, original_sender, NULL, packed_message, | send_message (destination, original_sender, NULL, packed_message, | |||
packed_message_size, default_dv_priority, | packed_message_size, default_dv_priority, | |||
ntohl (incoming->uid), | ntohl (incoming->uid), | |||
GNUNET_TIME_relative_get_forever ()); | GNUNET_TIME_UNIT_FOREVER_REL); | |||
} | } | |||
if (ret != GNUNET_SYSERR) | if (ret != GNUNET_SYSERR) | |||
return GNUNET_OK; | return GNUNET_OK; | |||
else | else | |||
{ | { | |||
#if DEBUG_MESSAGE_DROP | #if DEBUG_MESSAGE_DROP | |||
char *direct_id = GNUNET_strdup (GNUNET_i2s (&dn->identity)); | char *direct_id = GNUNET_strdup (GNUNET_i2s (&dn->identity)); | |||
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | |||
"%s: DROPPING MESSAGE type %d, forwarding failed! Message i mmediately from %s!\n", | "%s: DROPPING MESSAGE type %d, forwarding failed! Message i mmediately from %s!\n", | |||
skipping to change at line 1759 | skipping to change at line 1760 | |||
encPeerTo); | encPeerTo); | |||
GNUNET_free (encPeerAbout); | GNUNET_free (encPeerAbout); | |||
GNUNET_free (encPeerTo); | GNUNET_free (encPeerTo); | |||
#endif | #endif | |||
about->last_gossip = GNUNET_TIME_absolute_get (); | about->last_gossip = GNUNET_TIME_absolute_get (); | |||
pending_message = | pending_message = | |||
GNUNET_malloc (sizeof (struct PendingMessage) + | GNUNET_malloc (sizeof (struct PendingMessage) + | |||
sizeof (p2p_dv_MESSAGE_NeighborInfo)); | sizeof (p2p_dv_MESSAGE_NeighborInfo)); | |||
pending_message->msg = (struct GNUNET_MessageHeader *) &pending_message [1]; | pending_message->msg = (struct GNUNET_MessageHeader *) &pending_message [1]; | |||
pending_message->importance = default_dv_priority; | pending_message->importance = default_dv_priority; | |||
pending_message->timeout = GNUNET_TIME_relative_get_forever (); | pending_message->timeout = GNUNET_TIME_UNIT_FOREVER_REL; | |||
memcpy (&pending_message->recipient, &to->identity, | memcpy (&pending_message->recipient, &to->identity, | |||
sizeof (struct GNUNET_PeerIdentity)); | sizeof (struct GNUNET_PeerIdentity)); | |||
pending_message->msg_size = sizeof (p2p_dv_MESSAGE_NeighborInfo); | pending_message->msg_size = sizeof (p2p_dv_MESSAGE_NeighborInfo); | |||
message = (p2p_dv_MESSAGE_NeighborInfo *) pending_message->msg; | message = (p2p_dv_MESSAGE_NeighborInfo *) pending_message->msg; | |||
message->header.size = htons (sizeof (p2p_dv_MESSAGE_NeighborInfo)); | message->header.size = htons (sizeof (p2p_dv_MESSAGE_NeighborInfo)); | |||
message->header.type = htons (GNUNET_MESSAGE_TYPE_DV_GOSSIP); | message->header.type = htons (GNUNET_MESSAGE_TYPE_DV_GOSSIP); | |||
message->cost = htonl (about->cost); | message->cost = htonl (about->cost); | |||
message->neighbor_id = htonl (about->our_id); | message->neighbor_id = htonl (about->our_id); | |||
memcpy (&message->pkey, about->pkey, | memcpy (&message->pkey, about->pkey, | |||
sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded)); | sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded)); | |||
memcpy (&message->neighbor, &about->identity, | memcpy (&message->neighbor, &about->identity, | |||
sizeof (struct GNUNET_PeerIdentity)); | sizeof (struct GNUNET_PeerIdentity)); | |||
GNUNET_CONTAINER_DLL_insert_after (core_pending_head, core_pending_tail , | GNUNET_CONTAINER_DLL_insert_after (core_pending_head, core_pending_tail , | |||
core_pending_tail, pending_message); | core_pending_tail, pending_message); | |||
GNUNET_SCHEDULER_add_now (try_core_send, NULL); | GNUNET_SCHEDULER_add_now (try_core_send, NULL); | |||
/*if (core_transmit_handle == NULL) | /*if (core_transmit_handle == NULL) | |||
* core_transmit_handle = GNUNET_CORE_notify_transmit_ready(coreAPI, GN UNET_YES, default_dv_priority, GNUNET_TIME_relative_get_forever(), &to->id entity, sizeof(p2p_dv_MESSAGE_NeighborInfo), &core_transmit_notify, NULL); */ | * core_transmit_handle = GNUNET_CORE_notify_transmit_ready(coreAPI, GN UNET_YES, default_dv_priority, GNUNET_TIME_UNIT_FOREVER_REL, &to->identity , sizeof(p2p_dv_MESSAGE_NeighborInfo), &core_transmit_notify, NULL); */ | |||
} | } | |||
if (send_context->fast_gossip_list_head != NULL) /* If there are oth er peers in the fast list, schedule right away */ | if (send_context->fast_gossip_list_head != NULL) /* If there are oth er peers in the fast list, schedule right away */ | |||
{ | { | |||
#if DEBUG_DV_PEER_NUMBERS | #if DEBUG_DV_PEER_NUMBERS | |||
GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | |||
"DV SERVICE: still in fast send mode\n"); | "DV SERVICE: still in fast send mode\n"); | |||
#endif | #endif | |||
send_context->task = | send_context->task = | |||
skipping to change at line 2185 | skipping to change at line 2186 | |||
if (memcmp | if (memcmp | |||
(¬ify->identity, &disconnected->identity, | (¬ify->identity, &disconnected->identity, | |||
sizeof (struct GNUNET_PeerIdentity)) == 0) | sizeof (struct GNUNET_PeerIdentity)) == 0) | |||
return GNUNET_YES; /* Don't send disconnect message to peer th at disconnected! */ | return GNUNET_YES; /* Don't send disconnect message to peer th at disconnected! */ | |||
pending_message = | pending_message = | |||
GNUNET_malloc (sizeof (struct PendingMessage) + | GNUNET_malloc (sizeof (struct PendingMessage) + | |||
sizeof (p2p_dv_MESSAGE_Disconnect)); | sizeof (p2p_dv_MESSAGE_Disconnect)); | |||
pending_message->msg = (struct GNUNET_MessageHeader *) &pending_message[1 ]; | pending_message->msg = (struct GNUNET_MessageHeader *) &pending_message[1 ]; | |||
pending_message->importance = default_dv_priority; | pending_message->importance = default_dv_priority; | |||
pending_message->timeout = GNUNET_TIME_relative_get_forever (); | pending_message->timeout = GNUNET_TIME_UNIT_FOREVER_REL; | |||
memcpy (&pending_message->recipient, ¬ify->identity, | memcpy (&pending_message->recipient, ¬ify->identity, | |||
sizeof (struct GNUNET_PeerIdentity)); | sizeof (struct GNUNET_PeerIdentity)); | |||
pending_message->msg_size = sizeof (p2p_dv_MESSAGE_Disconnect); | pending_message->msg_size = sizeof (p2p_dv_MESSAGE_Disconnect); | |||
disconnect_message = (p2p_dv_MESSAGE_Disconnect *) pending_message->msg; | disconnect_message = (p2p_dv_MESSAGE_Disconnect *) pending_message->msg; | |||
disconnect_message->header.size = htons (sizeof (p2p_dv_MESSAGE_Disconnec t)); | disconnect_message->header.size = htons (sizeof (p2p_dv_MESSAGE_Disconnec t)); | |||
disconnect_message->header.type = htons (GNUNET_MESSAGE_TYPE_DV_DISCONNEC T); | disconnect_message->header.type = htons (GNUNET_MESSAGE_TYPE_DV_DISCONNEC T); | |||
disconnect_message->peer_id = htonl (disconnect_context->distant->our_id) ; | disconnect_message->peer_id = htonl (disconnect_context->distant->our_id) ; | |||
GNUNET_CONTAINER_DLL_insert_after (core_pending_head, core_pending_tail, | GNUNET_CONTAINER_DLL_insert_after (core_pending_head, core_pending_tail, | |||
core_pending_tail, pending_message); | core_pending_tail, pending_message); | |||
GNUNET_SCHEDULER_add_now (try_core_send, NULL); | GNUNET_SCHEDULER_add_now (try_core_send, NULL); | |||
/*if (core_transmit_handle == NULL) | /*if (core_transmit_handle == NULL) | |||
* core_transmit_handle = GNUNET_CORE_notify_transmit_ready(coreAPI, GNUN ET_YES, default_dv_priority, GNUNET_TIME_relative_get_forever(), ¬ify->i dentity, sizeof(p2p_dv_MESSAGE_Disconnect), &core_transmit_notify, NULL); * / | * core_transmit_handle = GNUNET_CORE_notify_transmit_ready(coreAPI, GNUN ET_YES, default_dv_priority, GNUNET_TIME_UNIT_FOREVER_REL, ¬ify->identit y, sizeof(p2p_dv_MESSAGE_Disconnect), &core_transmit_notify, NULL); */ | |||
return GNUNET_YES; | return GNUNET_YES; | |||
} | } | |||
/** | /** | |||
* Multihashmap iterator for freeing extended neighbors. | * Multihashmap iterator for freeing extended neighbors. | |||
* | * | |||
* @param cls NULL | * @param cls NULL | |||
* @param key key value stored under | * @param key key value stored under | |||
* @param value the distant neighbor to be freed | * @param value the distant neighbor to be freed | |||
End of changes. 9 change blocks. | ||||
8 lines changed or deleted | 9 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |