[Pkg-telepathy-commits] [libnice] 03/265: Open socket with random port. Use random port to avoid TURN error 437 Allocation Mismatch
Simon McVittie
smcv at debian.org
Wed May 14 12:04:46 UTC 2014
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to branch debian
in repository libnice.
commit e176b4143ce907e71c5a1e5e38698e027e887114
Author: Livio Madaro <livio.madaro at telecomitalia.it>
Date: Thu Mar 7 17:46:34 2013 +0100
Open socket with random port. Use random port to avoid TURN error 437 Allocation Mismatch
---
agent/agent.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/agent/agent.c b/agent/agent.c
index e8b550f..0b4fdff 100644
--- a/agent/agent.c
+++ b/agent/agent.c
@@ -1827,11 +1827,16 @@ nice_agent_gather_candidates (
for (n = 0; n < stream->n_components; n++) {
Component *component = stream_find_component_by_id (stream, n + 1);
guint current_port;
+ guint start_port;
if (component == NULL)
continue;
- current_port = component->min_port;
+ start_port = component->min_port;
+ if(component->min_port != 0) {
+ start_port = nice_rng_generate_int(agent->rng, component->min_port, component->max_port+1);
+ }
+ current_port = start_port;
if (agent->reliable && component->tcp == NULL) {
nice_debug ("Agent %p: not gathering candidates for s%d:%d because "
@@ -1848,7 +1853,8 @@ nice_agent_gather_candidates (
n + 1, addr);
if (current_port > 0)
current_port++;
- if (current_port == 0 || current_port > component->max_port)
+ if (current_port > component->max_port) current_port = component->min_port;
+ if (current_port == 0 || current_port == start_port)
break;
}
nice_address_set_port (addr, 0);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-telepathy/libnice.git
More information about the Pkg-telepathy-commits
mailing list