diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-06-17 15:27:19 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-06-17 15:27:19 +0000 |
commit | 344da83a5a06b4b4db4eb68972ee49333369f2db (patch) | |
tree | 9463373acc8f042ab2e05d27746dba6c0566bced /src/dv/plugin_transport_dv.c | |
parent | 3084c1f3deba86b52b1e01fefbcf7474fe0f5d1c (diff) | |
download | gnunet-344da83a5a06b4b4db4eb68972ee49333369f2db.tar.gz gnunet-344da83a5a06b4b4db4eb68972ee49333369f2db.zip |
working distance vector transport plugin implementation. after spending days on it I think the problem (not all peers connect all the time) either lies in core, or is related to latency
Diffstat (limited to 'src/dv/plugin_transport_dv.c')
-rw-r--r-- | src/dv/plugin_transport_dv.c | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/src/dv/plugin_transport_dv.c b/src/dv/plugin_transport_dv.c index a8c05d309..43bbfad33 100644 --- a/src/dv/plugin_transport_dv.c +++ b/src/dv/plugin_transport_dv.c | |||
@@ -173,17 +173,20 @@ void handle_dv_message_received (void *cls, | |||
173 | size_t sender_address_len) | 173 | size_t sender_address_len) |
174 | { | 174 | { |
175 | struct Plugin *plugin = cls; | 175 | struct Plugin *plugin = cls; |
176 | 176 | #if DEBUG_DV_MESSAGES | |
177 | char *my_id; | ||
178 | my_id = GNUNET_strdup(GNUNET_i2s(plugin->env->my_identity)); | ||
177 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, | 179 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, |
178 | "plugin_transport_dv", | 180 | "plugin_transport_dv", |
179 | _("PLUGIN Received message from %s of type %d, distance %u!\n"), | 181 | _("%s Received message from %s) of type %d, distance %u!\n"), |
180 | "DV SERVICE", ntohs(((struct GNUNET_MessageHeader *)msg)->type), distance); | 182 | my_id, GNUNET_i2s(sender), ntohs(((struct GNUNET_MessageHeader *)msg)->type), distance); |
181 | 183 | GNUNET_free_non_null(my_id); | |
184 | #endif | ||
182 | plugin->env->receive(plugin->env->cls, | 185 | plugin->env->receive(plugin->env->cls, |
183 | sender, | 186 | sender, |
184 | (struct GNUNET_MessageHeader *)msg, | 187 | (struct GNUNET_MessageHeader *)msg, |
185 | distance, | 188 | distance, |
186 | NULL, /* FIXME: pass session! */ | 189 | NULL, |
187 | sender_address, | 190 | sender_address, |
188 | sender_address_len); | 191 | sender_address_len); |
189 | 192 | ||
@@ -237,9 +240,23 @@ dv_plugin_send (void *cls, | |||
237 | { | 240 | { |
238 | int ret = 0; | 241 | int ret = 0; |
239 | struct Plugin *plugin = cls; | 242 | struct Plugin *plugin = cls; |
240 | 243 | const char *tempbuf; | |
244 | int temp_size; | ||
241 | #if DEBUG_DV | 245 | #if DEBUG_DV |
246 | char *my_identity; | ||
242 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "DV API: Received send request from transport, calling GNUNET_DV_send\n"); | 247 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "DV API: Received send request from transport, calling GNUNET_DV_send\n"); |
248 | my_identity = GNUNET_strdup(GNUNET_i2s(plugin->env->my_identity)); | ||
249 | #endif | ||
250 | temp_size = htons(((struct GNUNET_MessageHeader *)msgbuf)->size); | ||
251 | if (msgbuf_size > temp_size) | ||
252 | { | ||
253 | tempbuf = &msgbuf[temp_size]; | ||
254 | #if DEBUG_DV | ||
255 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "%s DV PLUGIN SEND SPECIAL type %d to %s\n", my_identity, ntohs(((struct GNUNET_MessageHeader *)tempbuf)->type), GNUNET_i2s(target)); | ||
256 | #endif | ||
257 | } | ||
258 | #if DEBUG_DV | ||
259 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "%s DV PLUGIN SEND type %d to %s\n", my_identity, ntohs(((struct GNUNET_MessageHeader *)msgbuf)->type), GNUNET_i2s(target)); | ||
243 | #endif | 260 | #endif |
244 | ret = GNUNET_DV_send(plugin->dv_handle, | 261 | ret = GNUNET_DV_send(plugin->dv_handle, |
245 | target, | 262 | target, |
@@ -251,6 +268,9 @@ dv_plugin_send (void *cls, | |||
251 | addrlen, | 268 | addrlen, |
252 | cont, | 269 | cont, |
253 | cont_cls); | 270 | cont_cls); |
271 | #if DEBUG_DV | ||
272 | GNUNET_free_non_null(my_identity); | ||
273 | #endif | ||
254 | 274 | ||
255 | return ret; | 275 | return ret; |
256 | } | 276 | } |