[Nice] Bug: Gather candidates never completes

Youness Alaoui youness.alaoui at collabora.co.uk
Thu Jan 20 17:38:51 PST 2011

On 08/20/2010 02:47 PM, Tom Kaminski wrote:
> I've came across a scenario where gather candidate done event never
> gets triggered.
> This happens if you disconnect one of your local network interfaces
> interfaces after nice agent has added it to it's local_addresses list.
>   The next time you try to gather candidates, it will issue the warning
> in nice_agent_gather_candidates()
> if (!host_candidate) {
>          g_warning ("No host candidate??");
>          return FALSE;
> }
> I changed it to
> if (!host_candidate) {
>          g_warning ("No host candidate??");
>          continue;
> }
> To fix this problem.
I have kept this behavior but for different reasons (see below). But the local 
addresses doesn't get modified during the call to gather_candidates anymore.

> Better yet, I think libnice should also repopulate it's
> agent->local_addresses list everytime nice_agent_gather_candidates()
> is called (in the case where the local addresses haven't been manually
> set).
done in 0.1.0 :)

> On a different note, is it safe to decrease the STUN_END_TIMEOUT value
> in timer.c?  It is painfully long (causing people to complain).  We
> had a previous discussion on this mail list about this timeout and the
> possibility of only performing stun discovery on the interfaces of
> interest (ie. the interfaces that are known to not timeout).  My idea
> was to find out which interface is being used to connect to my public
> server via tcp, but apparently the OS doesn't really provide
> information on which interface is being used by a given socket.  Any
> thoughts on this timeout issue would be appreciated.
As discussed later in this thread, it's done.

> I was also wondering if anyone has advice/recommendations what's the
> best way to use libnice with a router that has port forwarding enabled
> for a range of UDP ports.  My understanding is that by setting up port
> forwarding will increase the likelihood that connection establishment
> will succeed (especially for routers that do not work with the
> existing NAT punchthrough method used by libnice).

I've added the nice_agent_set_port_range API for this specific usecase. You give 
it a min_port/max_port for a specific component, before calling 
nice_agent_gather_candidates, and it will listen to a port in that range (starts 
at min_port and increments). If there are no ports available, the 
nice_agent_gather_candidates call will return FALSE.

> Thanks,
> Tom
> _______________________________________________
> Nice mailing list
> Nice at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/nice

More information about the Nice mailing list