From f025d7553b16d3e51b3cba37782bc1c2eaf2a0a0 Mon Sep 17 00:00:00 2001 From: oana Date: Fri, 14 Dec 2012 14:46:19 +0000 Subject: [PATCH] If when writing data on the application socket the select call fails, do not try again, but return immediately. On application thread cleanup, release the application mutex immediately after setting the pointer to the socket to null. git-svn-id: http://yate.null.ro/svn/yate/trunk@5360 acf43c95-373e-0410-b603-e72c3f656dc1 --- modules/sig/camel_map.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/modules/sig/camel_map.cpp b/modules/sig/camel_map.cpp index e278a1af..2f6ff9a8 100644 --- a/modules/sig/camel_map.cpp +++ b/modules/sig/camel_map.cpp @@ -7016,9 +7016,12 @@ bool XMLConnection::writeData(XmlFragment* elem) const char* buffer = xml.c_str(); while (m_socket && (len > 0)) { bool writeOk = false,error = false; - if (!m_socket->select(0,&writeOk,&error,idleUsec())) + if (!m_socket->select(0,&writeOk,&error,idleUsec()) || error) { + if (!m_socket->canRetry()) + return false; continue; - if (!writeOk || error) + } + if (!writeOk ) continue; int w = m_socket->writeData(buffer,len); if (w < 0) { @@ -8058,8 +8061,11 @@ void TcapXApplication::setIO(XMLConnection* io) { DDebug(&__plugin,DebugAll,"TcapXApplication::setIO(io=%p) - app=%s[%p]",io,m_name.c_str(),this); Lock l(this); + if (!m_io) + return; m_io = io; - if (!m_io && m_user) + l.drop(); + if (!io && m_user) m_user->removeApp(this); }