diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-12-05 13:01:41 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-12-05 13:01:41 +0000 |
commit | e78b82129a7936fa73d64b0d4d23972d2a1530a0 (patch) | |
tree | c43a05ec7153abfe1b48c342980fbdd15c40cb39 /src/dv/plugin_transport_dv.c | |
parent | c1cf618786cdf94086e7e36fa791e8fbcc57d9d1 (diff) | |
download | gnunet-e78b82129a7936fa73d64b0d4d23972d2a1530a0.tar.gz gnunet-e78b82129a7936fa73d64b0d4d23972d2a1530a0.zip |
fix ats information on session start
Diffstat (limited to 'src/dv/plugin_transport_dv.c')
-rw-r--r-- | src/dv/plugin_transport_dv.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/dv/plugin_transport_dv.c b/src/dv/plugin_transport_dv.c index 236cca8b6..f6ea3e736 100644 --- a/src/dv/plugin_transport_dv.c +++ b/src/dv/plugin_transport_dv.c | |||
@@ -311,21 +311,26 @@ handle_dv_connect (void *cls, | |||
311 | notify_distance_change (session); | 311 | notify_distance_change (session); |
312 | return; /* nothing to do */ | 312 | return; /* nothing to do */ |
313 | } | 313 | } |
314 | |||
314 | session = GNUNET_new (struct Session); | 315 | session = GNUNET_new (struct Session); |
315 | session->sender = *peer; | 316 | session->sender = *peer; |
316 | session->distance = distance; | 317 | session->distance = distance; |
317 | session->network = network; | 318 | session->network = network; |
318 | GNUNET_assert (GNUNET_YES == | 319 | GNUNET_assert( |
319 | GNUNET_CONTAINER_multipeermap_put (plugin->sessions, | 320 | GNUNET_YES == GNUNET_CONTAINER_multipeermap_put (plugin->sessions, |
320 | &session->sender, | 321 | &session->sender, session, |
321 | session, | 322 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); |
322 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 323 | |
324 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
325 | "Creating new session %p for peer `%s'\n", | ||
326 | session, | ||
327 | GNUNET_i2s (peer)); | ||
323 | 328 | ||
324 | /* Notify transport and ats about new connection */ | 329 | /* Notify transport and ats about new connection */ |
325 | ats[0].type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE); | 330 | ats[0].type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE); |
326 | ats[0].value = htonl (distance); | 331 | ats[0].value = htonl (distance); |
327 | ats[0].type = htonl (GNUNET_ATS_NETWORK_TYPE); | 332 | ats[1].type = htonl (GNUNET_ATS_NETWORK_TYPE); |
328 | ats[0].value = htonl (network); | 333 | ats[1].value = htonl (network); |
329 | plugin->env->session_start (plugin->env->cls, peer, PLUGIN_NAME, NULL, 0, | 334 | plugin->env->session_start (plugin->env->cls, peer, PLUGIN_NAME, NULL, 0, |
330 | session, ats, 2); | 335 | session, ats, 2); |
331 | } | 336 | } |
@@ -380,6 +385,12 @@ free_session (struct Session *session) | |||
380 | GNUNET_CONTAINER_multipeermap_remove (plugin->sessions, | 385 | GNUNET_CONTAINER_multipeermap_remove (plugin->sessions, |
381 | &session->sender, | 386 | &session->sender, |
382 | session)); | 387 | session)); |
388 | |||
389 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
390 | "Freeing session %p for peer `%s'\n", | ||
391 | session, | ||
392 | GNUNET_i2s (&session->sender)); | ||
393 | |||
383 | if (GNUNET_YES == session->active) | 394 | if (GNUNET_YES == session->active) |
384 | plugin->env->session_end (plugin->env->cls, | 395 | plugin->env->session_end (plugin->env->cls, |
385 | &session->sender, | 396 | &session->sender, |