Calling pjsua_detroy2 while resolving stun servers causes an assert

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
 Our project is trying to call pjsua_destroy2( PJSUA_DESTROY_NO_NETWORK ); directly after pjsua_init.

 First, we enter the stun servers names into mPjsuaConfig.stun_srv,

 We see that destroy_stun_resolve is failing at the assert:
 static void destroy_stun_resolve(pjsua_stun_resolve *sess)
{
    sess->destroy_flag = PJ_TRUE;
    if (sess->ref_cnt > 0)
	return;

    PJSUA_LOCK();
    pj_list_erase(sess);
    PJSUA_UNLOCK();

    pj_assert(sess->stun_sock==NULL);
    pj_pool_release(sess->pool);
}

The problem seems to be a call to resolve_stun_server(PJ_FALSE) from pjsua_init, the PJ_FALSE means the call will not wait for the stun server to be resolved before it continues. so this non-blocking call returns and pjsua_destroy2 can be called.

A workaround was to call pjsua_detect_nat_type, which internally calls resolve_stun_server(PJ_TRUE); that waits until the resolve is done.

What should be the best practice?

Thanks
Shaul Kedem
Yallo


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux