I forgot to attach the patch :)

bye
>From 8ad8f024107905b16851037587400b263e7b7ef1 Mon Sep 17 00:00:00 2001
From: Domenico Chierico <[email protected]>
Date: Fri, 29 Apr 2011 11:02:13 +0200
Subject: [PATCH] Fix problem with queue in SipTcpServer

---
 sipXtackLib/src/net/SipClient.cpp    |   11 -----------
 sipXtackLib/src/net/SipTcpServer.cpp |   15 ++++++++++++++-
 2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/sipXtackLib/src/net/SipClient.cpp b/sipXtackLib/src/net/SipClient.cpp
index b38655b..843bc8f 100644
--- a/sipXtackLib/src/net/SipClient.cpp
+++ b/sipXtackLib/src/net/SipClient.cpp
@@ -1003,17 +1003,6 @@ void SipClient::clientStopSelf()
 
    // Stop the run loop.
    OsTask::requestShutdown();
-   // Signal the owning SipServer to check for dead clients.
-   if (mpSipServer)
-   {
-      OsMsg message(OsMsg::OS_EVENT,
-                    SipProtocolServerBase::SIP_SERVER_GC);
-      // If the SipServer's queue is full, don't wait, since
-      // that can cause deadlocks.  The SipServer will eventually
-      // garbage-collect terminated clients spontaneously.
-      mpSipServer->postMessage(message,
-                               OsTime::NO_WAIT);
-   }
 }
 
 /* //////////////////////////// PRIVATE /////////////////////////////////// */
diff --git a/sipXtackLib/src/net/SipTcpServer.cpp b/sipXtackLib/src/net/SipTcpServer.cpp
index 2f4bc01..d155396 100644
--- a/sipXtackLib/src/net/SipTcpServer.cpp
+++ b/sipXtackLib/src/net/SipTcpServer.cpp
@@ -105,6 +105,7 @@ UtlBoolean SipTcpServer::startListener()
        (dynamic_cast <SipServerBroker*> (iterator.value()))->start();
        bRet = TRUE;
     }
+    start();
     return bRet;
 }
 
@@ -190,9 +191,21 @@ SipTcpServer::~SipTcpServer()
 
 int SipTcpServer::run(void* runArgument)
 {
+    OsMsg*    pMsg = NULL;
+    OsStatus  res;
+
     while (!isShuttingDown())
     {
-        OsTask::delay(500); // this method really shouldn't do anything
+        // this method really shouldn't do anything but empty the queue
+	res = receiveMessage((OsMsg*&) pMsg);
+	
+	if(res == OS_SUCCESS)
+        {
+	  if (!pMsg->getSentFromISR())
+	  {
+	        pMsg->releaseMsg();
+	  }
+	}
     }
 
     return (0);
-- 
1.7.4

_______________________________________________
sipx-dev mailing list
[email protected]
List Archive: http://list.sipfoundry.org/archive/sipx-dev/

Reply via email to