From e4b5a6b681d196cb233bf15a91060e3585933aa1 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 23 Jun 2012 22:31:43 +0000 Subject: -LRN: Check session target: It changes the Session object layout to make peer identity its first field, always, for all sessions. Code in find_session() can use this to check that the session belongs to the right peer. test_ats_api_add_address always triggers this due to the way it fakes a pointer to session object. --- src/transport/plugin_transport_http.h | 9 ++++----- src/transport/plugin_transport_tcp.c | 11 +++++------ src/transport/plugin_transport_template.c | 11 +++++------ src/transport/plugin_transport_unix.c | 3 ++- src/transport/plugin_transport_wlan.c | 11 +++++------ 5 files changed, 21 insertions(+), 24 deletions(-) (limited to 'src/transport') diff --git a/src/transport/plugin_transport_http.h b/src/transport/plugin_transport_http.h index 986d7d797..dc0f8bb01 100644 --- a/src/transport/plugin_transport_http.h +++ b/src/transport/plugin_transport_http.h @@ -339,6 +339,10 @@ struct ServerConnection */ struct Session { + /** + * To whom are we talking to + */ + struct GNUNET_PeerIdentity target; /** * Stored in a linked list. @@ -370,11 +374,6 @@ struct Session */ uint32_t ats_address_network_type; - /** - * To whom are we talking to - */ - struct GNUNET_PeerIdentity target; - /** * next pointer for double linked list */ diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c index a42621569..007e87f93 100644 --- a/src/transport/plugin_transport_tcp.c +++ b/src/transport/plugin_transport_tcp.c @@ -223,6 +223,11 @@ struct PendingMessage */ struct Session { + /** + * To whom are we talking to (set to our identity + * if we are still waiting for the welcome message) + */ + struct GNUNET_PeerIdentity target; /** * API requirement. @@ -261,12 +266,6 @@ struct Session */ struct GNUNET_SERVER_TransmitHandle *transmit_handle; - /** - * To whom are we talking to (set to our identity - * if we are still waiting for the welcome message) - */ - struct GNUNET_PeerIdentity target; - /** * ID of task used to delay receiving more to throttle sender. */ diff --git a/src/transport/plugin_transport_template.c b/src/transport/plugin_transport_template.c index d3072627e..10ce0da48 100644 --- a/src/transport/plugin_transport_template.c +++ b/src/transport/plugin_transport_template.c @@ -54,6 +54,11 @@ struct Plugin; */ struct Session { + /** + * To whom are we talking to (set to our identity + * if we are still waiting for the welcome message) + */ + struct GNUNET_PeerIdentity sender; /** * Stored in a linked list. @@ -82,12 +87,6 @@ struct Session */ void *transmit_cont_cls; - /** - * To whom are we talking to (set to our identity - * if we are still waiting for the welcome message) - */ - struct GNUNET_PeerIdentity sender; - /** * At what time did we reset last_received last? */ diff --git a/src/transport/plugin_transport_unix.c b/src/transport/plugin_transport_unix.c index 289fea0b6..b7e10b720 100644 --- a/src/transport/plugin_transport_unix.c +++ b/src/transport/plugin_transport_unix.c @@ -82,9 +82,10 @@ struct UNIXMessage struct Session { + struct GNUNET_PeerIdentity target; + void *addr; size_t addrlen; - struct GNUNET_PeerIdentity target; /** * Session timeout task diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c index aed4b2286..c2565a4a8 100644 --- a/src/transport/plugin_transport_wlan.c +++ b/src/transport/plugin_transport_wlan.c @@ -152,6 +152,11 @@ struct PendingMessage */ struct Session { + /** + * To whom are we talking to (set to our identity + * if we are still waiting for the welcome message) + */ + struct GNUNET_PeerIdentity target; /** * API requirement (must be first). @@ -185,12 +190,6 @@ struct Session */ struct PendingMessage *pending_message_tail; - /** - * To whom are we talking to (set to our identity - * if we are still waiting for the welcome message) - */ - struct GNUNET_PeerIdentity target; - /** * When should this session time out? */ -- cgit v1.2.3