summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2014-03-20 09:56:35 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2014-03-20 09:56:35 +0000
commit41c6d8c72b45cf9f0cb712efd140cf681ff5d11e (patch)
treed781d36ac67f776597a05ff6f8cb26f1e5e5cfa2 /src
parent9390558f789648d3951805432ecc4ca9badef40e (diff)
session end function must include address to notify address
Diffstat (limited to 'src')
-rw-r--r--src/transport/gnunet-service-transport.c51
-rw-r--r--src/transport/plugin_transport_bluetooth.c2
-rw-r--r--src/transport/plugin_transport_http_client.c2
-rw-r--r--src/transport/plugin_transport_http_server.c4
-rw-r--r--src/transport/plugin_transport_tcp.c2
-rw-r--r--src/transport/plugin_transport_udp.c2
-rw-r--r--src/transport/plugin_transport_unix.c2
-rw-r--r--src/transport/plugin_transport_wlan.c2
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,
* from the "TransmitFunction".
*
* @param cls closure
- * @param peer which peer was the session for
+ * @param address which address was the session for
* @param session which session is being destoyed
*/
static void
-plugin_env_session_end (void *cls, const struct GNUNET_PeerIdentity *peer,
+plugin_env_session_end (void *cls, const struct GNUNET_HELLO_Address *address,
struct Session *session)
{
- const char *transport_name = cls;
- struct GNUNET_HELLO_Address address;
struct SessionKiller *sk;
- GNUNET_assert(strlen (transport_name) > 0);
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Session %p to peer `%s' ended \n",
- session, GNUNET_i2s (peer));
- if (NULL != session)
- GNUNET_log_from(GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK,
- "transport-ats", "Telling ATS to destroy session %p from peer %s\n",
- session, GNUNET_i2s (peer));
-
- memset (&address, '\0', sizeof (address));
- address.peer = *peer;
- address.address = NULL;
- address.address_length = 0;
- address.transport_name = transport_name;
- GST_neighbours_session_terminated (peer, session);
+ if (NULL == address)
+ {
+ GNUNET_break (0);
+ return;
+ }
+
+ if (NULL == session)
+ {
+ GNUNET_break (0);
+ return;
+ }
+
+ GNUNET_assert(strlen (address->transport_name) > 0);
+ GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Session %p to peer `%s' ended \n",
+ session, GNUNET_i2s (&address->peer));
+
+ GNUNET_log(GNUNET_ERROR_TYPE_INFO,
+ "Notification from plugin `%s' about terminated %ssession %p from peer `%s' address `%s'\n",
+ address->transport_name,
+ GNUNET_HELLO_address_check_option (address,
+ GNUNET_HELLO_ADDRESS_INFO_INBOUND) ? "inbound " : "", session,
+ GNUNET_i2s (&address->peer), GST_plugins_a2s (address));
+
+ GST_neighbours_session_terminated (&address->peer, session);
+
+ GNUNET_log_from(GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK,
+ "transport-ats", "Telling ATS to destroy session %p from peer %s\n",
+ session, GNUNET_i2s (&address->peer));
/* Tell ATS that session has ended */
- GNUNET_ATS_address_destroyed (GST_ats, &address, session);
+ GNUNET_ATS_address_destroyed (GST_ats, address, session);
for (sk = sk_head; NULL != sk; sk = sk->next)
{
if (sk->session == session)
@@ -622,7 +634,6 @@ plugin_env_session_start (void *cls, struct GNUNET_HELLO_Address *address,
GNUNET_break(0);
return;
}
-
GNUNET_log(GNUNET_ERROR_TYPE_INFO,
"Notification from plugin `%s' about new %ssession %p from peer `%s' address `%s'\n",
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)
struct PendingMessage *pm;
endpoint->plugin->env->session_end (endpoint->plugin->env->cls,
- &session->target,
+ session->address,
session);
while (NULL != (pm = session->pending_message_head))
{
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,
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
"Session %p: notifying transport about ending session\n",s);
- plugin->env->session_end (plugin->env->cls, &s->target, s);
+ plugin->env->session_end (plugin->env->cls, s->address, s);
client_delete_session (s);
/* 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,
{
/* Notify transport immediately that this session is invalid */
s->session_ended = GNUNET_YES;
- plugin->env->session_end (plugin->env->cls, &s->target, s);
+ plugin->env->session_end (plugin->env->cls, s->address, s);
}
server_delete_session (plugin, s);
}
@@ -3048,7 +3048,7 @@ LIBGNUNET_PLUGIN_TRANSPORT_DONE (void *cls)
{
/* Notify transport immediately that this session is invalid */
pos->session_ended = GNUNET_YES;
- plugin->env->session_end (plugin->env->cls, &pos->target, pos);
+ plugin->env->session_end (plugin->env->cls, pos->address, pos);
}
server_delete_session (plugin, pos);
}
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)
plugin->env->unregister_quota_notification (plugin->env->cls,
&session->target, PLUGIN_NAME, session);
session->plugin->env->session_end (session->plugin->env->cls,
- &session->target, session);
+ session->address, session);
if (GNUNET_SCHEDULER_NO_TASK != session->nat_connection_timeout)
{
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)
GNUNET_free(udpw);
}
}
- plugin->env->session_end (plugin->env->cls, &s->target, s);
+ plugin->env->session_end (plugin->env->cls, s->address, s);
if (NULL != s->frag_ctx)
{
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,
"Disconnecting session for peer `%s' `%s'\n",
GNUNET_i2s (&s->target),
unix_address_to_string (NULL, s->address->address, s->address->address_length) );
- plugin->env->session_end (plugin->env->cls, &s->target, s);
+ plugin->env->session_end (plugin->env->cls, s->address, s);
removed = GNUNET_NO;
next = plugin->msg_head;
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,
struct PendingMessage *pm;
endpoint->plugin->env->session_end (endpoint->plugin->env->cls,
- &session->target,
+ session->address,
session);
while (NULL != (pm = session->pending_message_head))
{