Use a timed lock (if answer timeout is set) when serializing message send to script. Don't send the message to script if failed to lock for configured timeout.

git-svn-id: http://voip.null.ro/svn/yate@6325 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
marian 2018-10-01 11:31:59 +00:00
parent e5da301845
commit 5a2b44cb6a
1 changed files with 6 additions and 1 deletions

View File

@ -988,7 +988,12 @@ bool ExtModReceiver::received(Message &msg, int id)
{
if (m_dead || m_quit)
return false;
lock();
if (!lock(m_timeout > 0 ? ((long)m_timeout * 1000) : -1)) {
Alarm("extmodule","performance",DebugWarn,
"Failed to lock to queue message (%p) '%s' for %d msec [%p]",
&msg,msg.c_str(),m_timeout,this);
return false;
}
// check if we are no longer running
bool ok = (m_pid > 0) && !m_dead && m_in && m_in->valid() && m_out && m_out->valid();
if (ok && !m_reenter) {