Skip to content

Commit

Permalink
UDP associations' default timeout to be 15 seconds
Browse files Browse the repository at this point in the history
ref #262
  • Loading branch information
zonyitoo committed May 24, 2020
1 parent 1f75f7a commit 98474e2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/relay/udprelay/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,8 @@ mod utils;
pub const MAXIMUM_UDP_PAYLOAD_SIZE: usize = 65536;

/// Default association expire time
pub const DEFAULT_TIMEOUT: Duration = Duration::from_secs(5 * 60);
///
/// FIXME: It is very hard to decide how long this value should be.
/// For some usecases, clients may open a socket for sending just one packet,
/// which will eventually cause too many *useless* associations are kept in the server.
pub const DEFAULT_TIMEOUT: Duration = Duration::from_secs(15);

2 comments on commit 98474e2

@madeye
Copy link
Contributor

@madeye madeye commented on 98474e2 May 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It maybe not friendly to some online gaming, as they are using UDP hole punching to establish P2P connection between players.

IMO, the best solution is limit the capacity of the LRU connection cache.

@zonyitoo
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm.. OK. I will revert this.

Please sign in to comment.