diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2014-03-20 09:56:35 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2014-03-20 09:56:35 +0000 |
commit | 41c6d8c72b45cf9f0cb712efd140cf681ff5d11e (patch) | |
tree | d781d36ac67f776597a05ff6f8cb26f1e5e5cfa2 /src/transport | |
parent | 9390558f789648d3951805432ecc4ca9badef40e (diff) | |
download | gnunet-41c6d8c72b45cf9f0cb712efd140cf681ff5d11e.tar.gz gnunet-41c6d8c72b45cf9f0cb712efd140cf681ff5d11e.zip |
session end function must include address to notify address
Diffstat (limited to 'src/transport')
-rw-r--r-- | src/transport/gnunet-service-transport.c | 51 | ||||
-rw-r--r-- | src/transport/plugin_transport_bluetooth.c | 2 | ||||
-rw-r--r-- | src/transport/plugin_transport_http_client.c | 2 | ||||
-rw-r--r-- | src/transport/plugin_transport_http_server.c | 4 | ||||
-rw-r--r-- | src/transport/plugin_transport_tcp.c | 2 | ||||
-rw-r--r-- | src/transport/plugin_transport_udp.c | 2 | ||||
-rw-r--r-- | src/transport/plugin_transport_unix.c | 2 | ||||
-rw-r--r-- | src/transport/plugin_transport_wlan.c | 2 |
8 files changed, 39 insertions, 28 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index f9946a8e2..2bd608988 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c | |||
@@ -400,34 +400,46 @@ plugin_env_address_change_notification (void *cls, int add_remove, | |||
400 | * from the "TransmitFunction". | 400 | * from the "TransmitFunction". |
401 | * | 401 | * |
402 | * @param cls closure | 402 | * @param cls closure |
403 | * @param peer which peer was the session for | 403 | * @param address which address was the session for |
404 | * @param session which session is being destoyed | 404 | * @param session which session is being destoyed |
405 | */ | 405 | */ |
406 | static void | 406 | static void |
407 | plugin_env_session_end (void *cls, const struct GNUNET_PeerIdentity *peer, | 407 | plugin_env_session_end (void *cls, const struct GNUNET_HELLO_Address *address, |
408 | struct Session *session) | 408 | struct Session *session) |
409 | { | 409 | { |
410 | const char *transport_name = cls; | ||
411 | struct GNUNET_HELLO_Address address; | ||
412 | struct SessionKiller *sk; | 410 | struct SessionKiller *sk; |
413 | 411 | ||
414 | GNUNET_assert(strlen (transport_name) > 0); | 412 | if (NULL == address) |
415 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Session %p to peer `%s' ended \n", | 413 | { |
416 | session, GNUNET_i2s (peer)); | 414 | GNUNET_break (0); |
417 | if (NULL != session) | 415 | return; |
418 | GNUNET_log_from(GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, | 416 | } |
419 | "transport-ats", "Telling ATS to destroy session %p from peer %s\n", | 417 | |
420 | session, GNUNET_i2s (peer)); | 418 | if (NULL == session) |
421 | 419 | { | |
422 | memset (&address, '\0', sizeof (address)); | 420 | GNUNET_break (0); |
423 | address.peer = *peer; | 421 | return; |
424 | address.address = NULL; | 422 | } |
425 | address.address_length = 0; | 423 | |
426 | address.transport_name = transport_name; | 424 | GNUNET_assert(strlen (address->transport_name) > 0); |
427 | GST_neighbours_session_terminated (peer, session); | 425 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Session %p to peer `%s' ended \n", |
426 | session, GNUNET_i2s (&address->peer)); | ||
427 | |||
428 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, | ||
429 | "Notification from plugin `%s' about terminated %ssession %p from peer `%s' address `%s'\n", | ||
430 | address->transport_name, | ||
431 | GNUNET_HELLO_address_check_option (address, | ||
432 | GNUNET_HELLO_ADDRESS_INFO_INBOUND) ? "inbound " : "", session, | ||
433 | GNUNET_i2s (&address->peer), GST_plugins_a2s (address)); | ||
434 | |||
435 | GST_neighbours_session_terminated (&address->peer, session); | ||
436 | |||
437 | GNUNET_log_from(GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, | ||
438 | "transport-ats", "Telling ATS to destroy session %p from peer %s\n", | ||
439 | session, GNUNET_i2s (&address->peer)); | ||
428 | 440 | ||
429 | /* Tell ATS that session has ended */ | 441 | /* Tell ATS that session has ended */ |
430 | GNUNET_ATS_address_destroyed (GST_ats, &address, session); | 442 | GNUNET_ATS_address_destroyed (GST_ats, address, session); |
431 | for (sk = sk_head; NULL != sk; sk = sk->next) | 443 | for (sk = sk_head; NULL != sk; sk = sk->next) |
432 | { | 444 | { |
433 | if (sk->session == session) | 445 | if (sk->session == session) |
@@ -622,7 +634,6 @@ plugin_env_session_start (void *cls, struct GNUNET_HELLO_Address *address, | |||
622 | GNUNET_break(0); | 634 | GNUNET_break(0); |
623 | return; | 635 | return; |
624 | } | 636 | } |
625 | |||
626 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, | 637 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, |
627 | "Notification from plugin `%s' about new %ssession %p from peer `%s' address `%s'\n", | 638 | "Notification from plugin `%s' about new %ssession %p from peer `%s' address `%s'\n", |
628 | address->transport_name, | 639 | address->transport_name, |
diff --git a/src/transport/plugin_transport_bluetooth.c b/src/transport/plugin_transport_bluetooth.c index 266276730..c131645a4 100644 --- a/src/transport/plugin_transport_bluetooth.c +++ b/src/transport/plugin_transport_bluetooth.c | |||
@@ -661,7 +661,7 @@ free_session (struct Session *session) | |||
661 | struct PendingMessage *pm; | 661 | struct PendingMessage *pm; |
662 | 662 | ||
663 | endpoint->plugin->env->session_end (endpoint->plugin->env->cls, | 663 | endpoint->plugin->env->session_end (endpoint->plugin->env->cls, |
664 | &session->target, | 664 | session->address, |
665 | session); | 665 | session); |
666 | while (NULL != (pm = session->pending_message_head)) | 666 | while (NULL != (pm = session->pending_message_head)) |
667 | { | 667 | { |
diff --git a/src/transport/plugin_transport_http_client.c b/src/transport/plugin_transport_http_client.c index bd4487614..0554b1957 100644 --- a/src/transport/plugin_transport_http_client.c +++ b/src/transport/plugin_transport_http_client.c | |||
@@ -676,7 +676,7 @@ http_client_session_disconnect (void *cls, | |||
676 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 676 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, |
677 | "Session %p: notifying transport about ending session\n",s); | 677 | "Session %p: notifying transport about ending session\n",s); |
678 | 678 | ||
679 | plugin->env->session_end (plugin->env->cls, &s->target, s); | 679 | plugin->env->session_end (plugin->env->cls, s->address, s); |
680 | client_delete_session (s); | 680 | client_delete_session (s); |
681 | 681 | ||
682 | /* Re-schedule since handles have changed */ | 682 | /* Re-schedule since handles have changed */ |
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c index d1a36bc13..7550e7dee 100644 --- a/src/transport/plugin_transport_http_server.c +++ b/src/transport/plugin_transport_http_server.c | |||
@@ -1637,7 +1637,7 @@ server_disconnect_cb (void *cls, struct MHD_Connection *connection, | |||
1637 | { | 1637 | { |
1638 | /* Notify transport immediately that this session is invalid */ | 1638 | /* Notify transport immediately that this session is invalid */ |
1639 | s->session_ended = GNUNET_YES; | 1639 | s->session_ended = GNUNET_YES; |
1640 | plugin->env->session_end (plugin->env->cls, &s->target, s); | 1640 | plugin->env->session_end (plugin->env->cls, s->address, s); |
1641 | } | 1641 | } |
1642 | server_delete_session (plugin, s); | 1642 | server_delete_session (plugin, s); |
1643 | } | 1643 | } |
@@ -3048,7 +3048,7 @@ LIBGNUNET_PLUGIN_TRANSPORT_DONE (void *cls) | |||
3048 | { | 3048 | { |
3049 | /* Notify transport immediately that this session is invalid */ | 3049 | /* Notify transport immediately that this session is invalid */ |
3050 | pos->session_ended = GNUNET_YES; | 3050 | pos->session_ended = GNUNET_YES; |
3051 | plugin->env->session_end (plugin->env->cls, &pos->target, pos); | 3051 | plugin->env->session_end (plugin->env->cls, pos->address, pos); |
3052 | } | 3052 | } |
3053 | server_delete_session (plugin, pos); | 3053 | server_delete_session (plugin, pos); |
3054 | } | 3054 | } |
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index 9665fe5c9..976a6bc6b 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c | |||
@@ -782,7 +782,7 @@ tcp_disconnect_session (void *cls, struct Session *session) | |||
782 | plugin->env->unregister_quota_notification (plugin->env->cls, | 782 | plugin->env->unregister_quota_notification (plugin->env->cls, |
783 | &session->target, PLUGIN_NAME, session); | 783 | &session->target, PLUGIN_NAME, session); |
784 | session->plugin->env->session_end (session->plugin->env->cls, | 784 | session->plugin->env->session_end (session->plugin->env->cls, |
785 | &session->target, session); | 785 | session->address, session); |
786 | 786 | ||
787 | if (GNUNET_SCHEDULER_NO_TASK != session->nat_connection_timeout) | 787 | if (GNUNET_SCHEDULER_NO_TASK != session->nat_connection_timeout) |
788 | { | 788 | { |
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index 12e551fef..a25dfb334 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c | |||
@@ -1256,7 +1256,7 @@ udp_disconnect_session (void *cls, struct Session *s) | |||
1256 | GNUNET_free(udpw); | 1256 | GNUNET_free(udpw); |
1257 | } | 1257 | } |
1258 | } | 1258 | } |
1259 | plugin->env->session_end (plugin->env->cls, &s->target, s); | 1259 | plugin->env->session_end (plugin->env->cls, s->address, s); |
1260 | 1260 | ||
1261 | if (NULL != s->frag_ctx) | 1261 | if (NULL != s->frag_ctx) |
1262 | { | 1262 | { |
diff --git a/src/transport/plugin_transport_unix.c b/src/transport/plugin_transport_unix.c index 7bffa220d..036096f6d 100644 --- a/src/transport/plugin_transport_unix.c +++ b/src/transport/plugin_transport_unix.c | |||
@@ -548,7 +548,7 @@ unix_session_disconnect (void *cls, | |||
548 | "Disconnecting session for peer `%s' `%s'\n", | 548 | "Disconnecting session for peer `%s' `%s'\n", |
549 | GNUNET_i2s (&s->target), | 549 | GNUNET_i2s (&s->target), |
550 | unix_address_to_string (NULL, s->address->address, s->address->address_length) ); | 550 | unix_address_to_string (NULL, s->address->address, s->address->address_length) ); |
551 | plugin->env->session_end (plugin->env->cls, &s->target, s); | 551 | plugin->env->session_end (plugin->env->cls, s->address, s); |
552 | removed = GNUNET_NO; | 552 | removed = GNUNET_NO; |
553 | next = plugin->msg_head; | 553 | next = plugin->msg_head; |
554 | while (NULL != next) | 554 | while (NULL != next) |
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c index 36e09fdd7..124594e90 100644 --- a/src/transport/plugin_transport_wlan.c +++ b/src/transport/plugin_transport_wlan.c | |||
@@ -662,7 +662,7 @@ wlan_plugin_disconnect_session (void *cls, | |||
662 | struct PendingMessage *pm; | 662 | struct PendingMessage *pm; |
663 | 663 | ||
664 | endpoint->plugin->env->session_end (endpoint->plugin->env->cls, | 664 | endpoint->plugin->env->session_end (endpoint->plugin->env->cls, |
665 | &session->target, | 665 | session->address, |
666 | session); | 666 | session); |
667 | while (NULL != (pm = session->pending_message_head)) | 667 | while (NULL != (pm = session->pending_message_head)) |
668 | { | 668 | { |