[commit] r100 - in sofaswitch/trunk: controller server sofa/include/sofa sofa/src
Author: derek Date: Mon Sep 18 19:47:44 2006 New Revision: 100 Modified: sofaswitch/trunk/controller/testonemcu.py sofaswitch/trunk/controller/testonevoip.py sofaswitch/trunk/server/main.cxx sofaswitch/trunk/sofa/include/sofa/messages.h sofaswitch/trunk/sofa/src/messages.cxx sofaswitch/trunk/sofa/src/messlist.cxx Log: Update library to work better. Modified: sofaswitch/trunk/controller/testonemcu.py ============================================================================== --- sofaswitch/trunk/controller/testonemcu.py (original) +++ sofaswitch/trunk/controller/testonemcu.py Mon Sep 18 19:47:44 2006 @@ -23,7 +23,7 @@ ## each iteration is done in a new fork. expstart = time.time() -maxcalls = 200 +maxcalls = 20 calls = range(maxcalls) for i in calls: Modified: sofaswitch/trunk/controller/testonevoip.py ============================================================================== --- sofaswitch/trunk/controller/testonevoip.py (original) +++ sofaswitch/trunk/controller/testonevoip.py Mon Sep 18 19:47:44 2006 @@ -8,7 +8,7 @@ from basecall import * -maxcalls = 10 +maxcalls = 1 server = 'localhost' @@ -77,7 +77,7 @@ # controller.send_message_to('callnode h323:kauri', voipNode) controller.send_message_to('transferudp ' + voipNode, voipNode) - time.sleep(3); + time.sleep(30); controller.send_message_to('hangup', voipNode) controller.wait_event_on_list(controller.terminatingList, voipNode) Modified: sofaswitch/trunk/server/main.cxx ============================================================================== --- sofaswitch/trunk/server/main.cxx (original) +++ sofaswitch/trunk/server/main.cxx Mon Sep 18 19:47:44 2006 @@ -256,7 +256,7 @@ void Manager::AppendRunning(PSafePtr<TcpConnection> conn, const PString & id) { PTRACE(3, "Manager\tAppendRunning " << *conn); - + PTRACE(3, "Manager\tSupplied ID is \"" << id << "\""); if (id == PString("?")) { conn->GenerateSourceId(); PTRACE(3, "ADD " << conn->GetSourceId() << " which is a random Id"); @@ -546,7 +546,7 @@ return; } - + PTRACE(3, "Manager\tSetReadTimeout to 2 seconds"); messagesSocket.SetReadTimeout(2000); //We demand the source id within 2 seconds. //Get the id of the remote host connected on this socket if (!messagesSocket.Read(message.GetPointer(), 2000)) { @@ -555,7 +555,8 @@ return; } messagesSocket.SetReadTimeout(PMaxTimeInterval); - + PTRACE(5, "Manager\tHave read the first packet, and it was " << endl + << ::hex << message << ::dec); if (!manager.KeepRunning()) { PTRACE(2, "End of this tcp connection as the manager is ending now " << *this); manager.AppendDead(this); Modified: sofaswitch/trunk/sofa/include/sofa/messages.h ============================================================================== --- sofaswitch/trunk/sofa/include/sofa/messages.h (original) +++ sofaswitch/trunk/sofa/include/sofa/messages.h Mon Sep 18 19:47:44 2006 @@ -101,13 +101,18 @@ a particular call. Other uses are indeed possible. */ PTimeInterval TimeSinceCreation() { return PTime() - createdAt; } - /**Mark This frame as having been created right now, which is a - required function for those frames sitting in the pending - list */ + /**Mark This frame as having been created right now, which is a required + function for those frames sitting in the pending list */ void SetCreatedAtNow() { createdAt = PTime(); } - /**Set the name of the remote controller*/ + /**Set the name of the remote controller. This method sends a message to + the remote server, and advises the server who to inform on our + death. This means that the remote controller knows of our death, even + if we segfault and die.*/ void SetRemoteController(const PString & rc); + + /**Report the name of the remote controller.*/ + PString GetRemoteController() { return remoteController; } /**Report TRUE/FALSE if this message frame instance is in the process of closing down */ Modified: sofaswitch/trunk/sofa/src/messages.cxx ============================================================================== --- sofaswitch/trunk/sofa/src/messages.cxx (original) +++ sofaswitch/trunk/sofa/src/messages.cxx Mon Sep 18 19:47:44 2006 @@ -139,11 +139,6 @@ void MessageFrame::CloseMessagesSocket() { PTRACE(3, "Close messages socket for " << GetOurId()); - PTRACE(3, "Send Terminating to \"" << remoteController << "\""); - if (remoteController.IsEmpty()) { - PTRACE(3, "Not sent, as remoteController is not defined"); - } else - SendThisMessageTo("Terminating", remoteController); PThread::Sleep(100); //Let the message be sent, then close the socket. messagesSocket.Close(); @@ -902,6 +897,13 @@ remoteController = rc; PTRACE(3, "SET Remote controller to " << remoteController); + /*We now send a message to the server. This message tells the server that + when this node dies, to advise the designated node that we have died. + + With this approach, the remote controller (i.e. a python script) will + receive a message about our death even though this box segfaulted and died + in 1 nanosecond. */ + PStringStream message; message << "AdviseOnTermination " << rc; PBYTEArray binary; Modified: sofaswitch/trunk/sofa/src/messlist.cxx ============================================================================== --- sofaswitch/trunk/sofa/src/messlist.cxx (original) +++ sofaswitch/trunk/sofa/src/messlist.cxx Mon Sep 18 19:47:44 2006 @@ -285,6 +285,7 @@ PTRACE(1, "Delete old message frame thread pending thread"); delete removeOldMessageFrame; + PTRACE(1, "old Message Frame Pending collector now deleted. "); } void MessageFrameListPending::WaitForTermination()
participants (1)
-
SofaSWITCH SVN