diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2011-10-11 17:07:45 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2011-10-11 17:07:45 +0000 |
commit | 06ca63e03b0d8fd77673b3e759aab65dc5e0f3da (patch) | |
tree | f23e9c48d493764f13d506bd0efd21301fa0450d /src/transport | |
parent | e447ff928a492524ff23007280ad81c2fc691d56 (diff) | |
download | gnunet-06ca63e03b0d8fd77673b3e759aab65dc5e0f3da.tar.gz gnunet-06ca63e03b0d8fd77673b3e759aab65dc5e0f3da.zip |
address expiration
Diffstat (limited to 'src/transport')
-rw-r--r-- | src/transport/plugin_transport_udp.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index ec3e9fb10..c6ba8ef83 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include "gnunet_protocols.h" | 33 | #include "gnunet_protocols.h" |
34 | #include "gnunet_resolver_service.h" | 34 | #include "gnunet_resolver_service.h" |
35 | #include "gnunet_signatures.h" | 35 | #include "gnunet_signatures.h" |
36 | #include "gnunet_constants.h" | ||
36 | #include "gnunet_statistics_service.h" | 37 | #include "gnunet_statistics_service.h" |
37 | #include "gnunet_transport_service.h" | 38 | #include "gnunet_transport_service.h" |
38 | #include "gnunet_transport_plugin.h" | 39 | #include "gnunet_transport_plugin.h" |
@@ -170,6 +171,8 @@ struct PeerSession | |||
170 | */ | 171 | */ |
171 | struct GNUNET_FRAGMENT_Context *frag; | 172 | struct GNUNET_FRAGMENT_Context *frag; |
172 | 173 | ||
174 | struct GNUNET_TIME_Absolute valid_until; | ||
175 | |||
173 | }; | 176 | }; |
174 | 177 | ||
175 | 178 | ||
@@ -576,6 +579,13 @@ udp_plugin_send (void *cls, const struct GNUNET_PeerIdentity *target, | |||
576 | if ((session != NULL) && (addr != NULL) && (addrlen != 0)) | 579 | if ((session != NULL) && (addr != NULL) && (addrlen != 0)) |
577 | { | 580 | { |
578 | inbound_session = (struct PeerSession *) session; | 581 | inbound_session = (struct PeerSession *) session; |
582 | /* session timed out */ | ||
583 | if (GNUNET_TIME_absolute_get().abs_value > inbound_session->valid_until.abs_value) | ||
584 | { | ||
585 | /* TODO: remove session */ | ||
586 | if (force_address == GNUNET_SYSERR) | ||
587 | return GNUNET_SYSERR; | ||
588 | } | ||
579 | if (0 != memcmp (&inbound_session->target, target, sizeof (struct GNUNET_PeerIdentity))) | 589 | if (0 != memcmp (&inbound_session->target, target, sizeof (struct GNUNET_PeerIdentity))) |
580 | return GNUNET_SYSERR; | 590 | return GNUNET_SYSERR; |
581 | switch (addrlen) | 591 | switch (addrlen) |
@@ -802,6 +812,7 @@ process_udp_message (struct Plugin *plugin, const struct UDPMessage *msg, | |||
802 | s, | 812 | s, |
803 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE)); | 813 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE)); |
804 | } | 814 | } |
815 | s->valid_until = GNUNET_TIME_absolute_add(GNUNET_TIME_absolute_get(), GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); | ||
805 | 816 | ||
806 | /* iterate over all embedded messages */ | 817 | /* iterate over all embedded messages */ |
807 | si.sender = msg->sender; | 818 | si.sender = msg->sender; |