[Pkg-voip-commits] [resiprocate] 01/05: Imported Upstream version 1.9.1

Daniel Pocock pocock at moszumanska.debian.org
Sat Feb 22 08:20:32 UTC 2014


This is an automated email from the git hooks/post-receive script.

pocock pushed a commit to annotated tag debian/1.9.1-1
in repository resiprocate.

commit 85e5d60d42c2a86fbe5cf3eb51d05d2d2cec4e73
Author: Daniel Pocock <daniel at pocock.com.au>
Date:   Thu Feb 20 16:35:29 2014 +0100

    Imported Upstream version 1.9.1
---
 configure                        |  20 +++----
 configure.ac                     |   2 +-
 reTurn/StunMessage.cxx           |  14 ++---
 reTurn/client/ErrorCode.hxx      |   2 +-
 reTurn/client/TurnSocket.cxx     |   2 +-
 reTurn/reTurnServer.config       |   2 +-
 reflow/ErrorCode.hxx             |   4 +-
 repro/CommandServer.cxx          |   9 +--
 repro/CommandServer.hxx          |   7 +--
 repro/CommandServerThread.cxx    |   2 +-
 repro/CommandServerThread.hxx    |   2 +-
 repro/HttpBase.cxx               |   5 +-
 repro/RegSyncClient.cxx          |  84 ++++++++++++++++++++++-----
 repro/RegSyncServerThread.cxx    |   1 -
 repro/ReproRunner.cxx            | 120 ++++++++++++++++++++++++++-------------
 repro/ReproRunner.hxx            |  13 ++++-
 repro/WebAdminThread.cxx         |   7 +--
 repro/WebAdminThread.hxx         |   2 +-
 repro/XmlRpcServerBase.cxx       |   5 +-
 repro/reprocmd/reprocmd.cpp      |   2 +-
 resip/stack/TcpBaseTransport.cxx |  10 +++-
 resip/stack/WsDecorator.cxx      |   2 +-
 resip/stack/WsFrameExtractor.cxx |   1 +
 resip/stack/ssl/Security.cxx     |  12 ++--
 resiprocate.spec                 |   4 +-
 rutil/Log.cxx                    |   7 ++-
 rutil/SelectInterruptor.cxx      |   7 ++-
 rutil/dns/AresDns.cxx            |   9 ++-
 28 files changed, 242 insertions(+), 115 deletions(-)

diff --git a/configure b/configure
index 64ec8a5..024a7d9 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for resiprocate 1.9.0.
+# Generated by GNU Autoconf 2.69 for resiprocate 1.9.1.
 #
 #
 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -587,8 +587,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='resiprocate'
 PACKAGE_TARNAME='resiprocate'
-PACKAGE_VERSION='1.9.0'
-PACKAGE_STRING='resiprocate 1.9.0'
+PACKAGE_VERSION='1.9.1'
+PACKAGE_STRING='resiprocate 1.9.1'
 PACKAGE_BUGREPORT=''
 PACKAGE_URL=''
 
@@ -1394,7 +1394,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures resiprocate 1.9.0 to adapt to many kinds of systems.
+\`configure' configures resiprocate 1.9.1 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1464,7 +1464,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of resiprocate 1.9.0:";;
+     short | recursive ) echo "Configuration of resiprocate 1.9.1:";;
    esac
   cat <<\_ACEOF
 
@@ -1600,7 +1600,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-resiprocate configure 1.9.0
+resiprocate configure 1.9.1
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2143,7 +2143,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by resiprocate $as_me 1.9.0, which was
+It was created by resiprocate $as_me 1.9.1, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2971,7 +2971,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='resiprocate'
- VERSION='1.9.0'
+ VERSION='1.9.1'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -17677,7 +17677,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by resiprocate $as_me 1.9.0, which was
+This file was extended by resiprocate $as_me 1.9.1, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -17743,7 +17743,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-resiprocate config.status 1.9.0
+resiprocate config.status 1.9.1
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/configure.ac b/configure.ac
index b6f50db..8e30f19 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
 
-AC_INIT(resiprocate,1.9.0)
+AC_INIT(resiprocate,1.9.1)
 AC_CONFIG_SRCDIR(repro/repro.cxx)
 
 SO_RELEASE=`echo $PACKAGE_VERSION | cut -f1,2 -d.`
diff --git a/reTurn/StunMessage.cxx b/reTurn/StunMessage.cxx
index ae4717f..e6ff1ae 100644
--- a/reTurn/StunMessage.cxx
+++ b/reTurn/StunMessage.cxx
@@ -337,7 +337,7 @@ StunMessage::setStunAtrAddressFromTuple(StunAtrAddress& address, const StunTuple
    {
       // Note:  addr.ipv6 is stored in network byte order
       address.family = StunMessage::IPv6Family;  
-      memcpy(&address.addr.ipv6, tuple.getAddress().to_v6().to_bytes().c_array(), sizeof(address.addr.ipv6));
+      memcpy(&address.addr.ipv6, tuple.getAddress().to_v6().to_bytes().data(), sizeof(address.addr.ipv6));
    }
    else
    {
@@ -355,7 +355,7 @@ StunMessage::setTupleFromStunAtrAddress(StunTuple& tuple, const StunAtrAddress&
    {
       // Note:  addr.ipv6 is stored in network byte order
       asio::ip::address_v6::bytes_type bytes;
-      memcpy(bytes.c_array(), &address.addr.ipv6, bytes.size());
+      memcpy(bytes.data(), &address.addr.ipv6, bytes.size());
       asio::ip::address_v6 addr(bytes);
       tuple.setAddress(addr);
    }
@@ -1188,7 +1188,7 @@ operator<<( EncodeStream& strm, const StunMessage::StunAtrAddress& addr)
    if(addr.family == StunMessage::IPv6Family)
    {
       asio::ip::address_v6::bytes_type bytes;
-      memcpy(bytes.c_array(), &addr.addr.ipv6, bytes.size());
+      memcpy(bytes.data(), &addr.addr.ipv6, bytes.size());
       asio::ip::address_v6 addrv6(bytes);
 
       strm << "[" << addrv6.to_string() << "]:" << addr.port;
@@ -1715,11 +1715,11 @@ StunMessage::createUsernameAndPassword()
 
    if(mRemoteTuple.getAddress().is_v6())
    {
-      *mUsername = Data(mRemoteTuple.getAddress().to_v6().to_bytes().c_array(), mRemoteTuple.getAddress().to_v6().to_bytes().size()).base64encode() + ":";
+      *mUsername = Data(mRemoteTuple.getAddress().to_v6().to_bytes().data(), mRemoteTuple.getAddress().to_v6().to_bytes().size()).base64encode() + ":";
    }
    else
    {
-      *mUsername = Data(mRemoteTuple.getAddress().to_v4().to_bytes().c_array(), mRemoteTuple.getAddress().to_v4().to_bytes().size()).base64encode() + ":";
+      *mUsername = Data(mRemoteTuple.getAddress().to_v4().to_bytes().data(), mRemoteTuple.getAddress().to_v4().to_bytes().size()).base64encode() + ":";
    }
    unsigned int port = mRemoteTuple.getPort();
    *mUsername += Data((char*)&port, sizeof(unsigned int)).base64encode() + ":"; 
@@ -1767,7 +1767,7 @@ StunMessage::getTupleFromUsername(StunTuple& tuple)
       Data addressPart(Data::Share, mUsername->data(), 24); 
       addressPart = addressPart.base64decode();
       asio::ip::address_v6::bytes_type bytes;
-      memcpy(bytes.c_array(), addressPart.data(), bytes.size());
+      memcpy(bytes.data(), addressPart.data(), bytes.size());
       asio::ip::address_v6 addressv6(bytes);
       tuple.setAddress(addressv6);
 
@@ -1782,7 +1782,7 @@ StunMessage::getTupleFromUsername(StunTuple& tuple)
       Data addressPart(Data::Share, mUsername->data(), 8);  
       addressPart = addressPart.base64decode();
       asio::ip::address_v4::bytes_type bytes;
-      memcpy(bytes.c_array(), addressPart.data(), bytes.size());
+      memcpy(bytes.data(), addressPart.data(), bytes.size());
       asio::ip::address_v4 addressv4(bytes);
       tuple.setAddress(addressv4);
 
diff --git a/reTurn/client/ErrorCode.hxx b/reTurn/client/ErrorCode.hxx
index 754a82f..7d8d3af 100644
--- a/reTurn/client/ErrorCode.hxx
+++ b/reTurn/client/ErrorCode.hxx
@@ -5,7 +5,7 @@
 
 namespace reTurn {
 
-typedef asio::error_code::value_type ErrorType;
+typedef int ErrorType;
 
 static const ErrorType Success                               = 0;
 static const ErrorType GeneralError                          = -1;
diff --git a/reTurn/client/TurnSocket.cxx b/reTurn/client/TurnSocket.cxx
index 9313864..155a11a 100644
--- a/reTurn/client/TurnSocket.cxx
+++ b/reTurn/client/TurnSocket.cxx
@@ -573,7 +573,7 @@ TurnSocket::sendTo(RemotePeer& remotePeer, const char* buffer, unsigned int size
       if(remotePeer.getPeerTuple().getAddress().is_v6())
       {
          ind.mTurnXorPeerAddress[0].family = StunMessage::IPv6Family;
-         memcpy(&ind.mTurnXorPeerAddress[0].addr.ipv6, remotePeer.getPeerTuple().getAddress().to_v6().to_bytes().c_array(), sizeof(ind.mTurnXorPeerAddress[0].addr.ipv6));
+         memcpy(&ind.mTurnXorPeerAddress[0].addr.ipv6, remotePeer.getPeerTuple().getAddress().to_v6().to_bytes().data(), sizeof(ind.mTurnXorPeerAddress[0].addr.ipv6));
       }
       else
       {
diff --git a/reTurn/reTurnServer.config b/reTurn/reTurnServer.config
index 601b451..eedb0bc 100644
--- a/reTurn/reTurnServer.config
+++ b/reTurn/reTurnServer.config
@@ -209,7 +209,7 @@ TlsServerCertificateFilename = server.pem
 # that will be presented to clients connecting over TLS.
 # If not specified, reTurn will also try to find the private key
 # in the file specified by TlsServerCertificateFilename
-TlsServerPrivateKeyFilename = server-key.pem
+TlsServerPrivateKeyFilename = 
 
 # TLS temporary Diffie-Hellman parameters file (loaded from working directory)
 # Can be generated with the command:
diff --git a/reflow/ErrorCode.hxx b/reflow/ErrorCode.hxx
index 90f3670..dd78be8 100644
--- a/reflow/ErrorCode.hxx
+++ b/reflow/ErrorCode.hxx
@@ -1,11 +1,9 @@
 #ifndef FM_ERRORCODE_HXX
 #define FM_ERRORCODE_HXX
 
-#include <asio/error_code.hpp>
-
 namespace flowmanager {
 
-typedef asio::error_code::value_type ErrorType;
+typedef int ErrorType;
 
 static const ErrorType Success                               = 0;
 static const ErrorType GeneralError                          = -1;
diff --git a/repro/CommandServer.cxx b/repro/CommandServer.cxx
index 7aaca9a..f85be2e 100644
--- a/repro/CommandServer.cxx
+++ b/repro/CommandServer.cxx
@@ -33,7 +33,6 @@ CommandServer::CommandServer(ReproRunner& reproRunner,
    XmlRpcServerBase(port, version, ipAddr),
    mReproRunner(reproRunner)
 {
-   reproRunner.getProxy()->getStack().setExternalStatsHandler(this);
 }
 
 CommandServer::~CommandServer()
@@ -53,7 +52,7 @@ CommandServer::sendResponse(unsigned int connectionId,
    if(!responseData.empty())
    { 
       ss << "    <Data>" << Symbols::CRLF;
-      ss << responseData;
+      ss << responseData.xmlCharDataEncode();
       ss << "    </Data>" << Symbols::CRLF;
    }
    XmlRpcServerBase::sendResponse(connectionId, requestId, ss.str().c_str(), resultCode >= 200 /* isFinal */);
@@ -159,8 +158,8 @@ CommandServer::handleGetStackStatsRequest(unsigned int connectionId, unsigned in
    }
 }
 
-bool 
-CommandServer::operator()(resip::StatisticsMessage &statsMessage)
+void 
+CommandServer::handleStatisticsMessage(resip::StatisticsMessage &statsMessage)
 {
    Lock lock(mStatisticsWaitersMutex);
    if(mStatisticsWaiters.size() > 0)
@@ -177,7 +176,6 @@ CommandServer::operator()(resip::StatisticsMessage &statsMessage)
          sendResponse(it->first, it->second, buffer, 200, "Stack stats retrieved.");
       }
    }
-   return true;
 }
 
 void 
@@ -375,7 +373,6 @@ CommandServer::handleRestartRequest(unsigned int connectionId, unsigned int requ
    mReproRunner.restart();
    if(mReproRunner.getProxy())
    {
-      mReproRunner.getProxy()->getStack().setExternalStatsHandler(this);
       sendResponse(connectionId, requestId, Data::Empty, 200, "Restart completed.");
    }
    else
diff --git a/repro/CommandServer.hxx b/repro/CommandServer.hxx
index e9eed6c..126d3f1 100644
--- a/repro/CommandServer.hxx
+++ b/repro/CommandServer.hxx
@@ -5,7 +5,6 @@
 #include <rutil/dns/DnsStub.hxx>
 #include <rutil/TransportType.hxx>
 #include <rutil/XMLCursor.hxx>
-#include <resip/stack/StatisticsHandler.hxx>
 #include <resip/stack/StatisticsMessage.hxx>
 #include <resip/dum/InMemorySyncRegDb.hxx>
 #include "repro/XmlRpcServerBase.hxx"
@@ -21,8 +20,7 @@ namespace repro
 class ReproRunner;
 
 class CommandServer: public XmlRpcServerBase,
-                     public resip::GetDnsCacheDumpHandler,
-                     public resip::ExternalStatsHandler
+                     public resip::GetDnsCacheDumpHandler
 {
 public:
    CommandServer(ReproRunner& reproRunner,
@@ -38,6 +36,8 @@ public:
                              unsigned int resultCode, 
                              const resip::Data& resultText);
 
+   virtual void handleStatisticsMessage(resip::StatisticsMessage &statsMessage);
+
 protected:
    virtual void handleRequest(unsigned int connectionId, 
                               unsigned int requestId, 
@@ -45,7 +45,6 @@ protected:
 
    // Handlers
    virtual void onDnsCacheDumpRetrieved(std::pair<unsigned long, unsigned long> key, const resip::Data& dnsEntryStrings);
-   virtual bool operator()(resip::StatisticsMessage &statsMessage);
 
 private: 
    void handleGetStackInfoRequest(unsigned int connectionId, unsigned int requestId, resip::XMLCursor& xml);
diff --git a/repro/CommandServerThread.cxx b/repro/CommandServerThread.cxx
index aa6b1f9..9d5cb4d 100644
--- a/repro/CommandServerThread.cxx
+++ b/repro/CommandServerThread.cxx
@@ -24,7 +24,7 @@ CommandServerThread::thread()
       {
            FdSet fdset; 
      
-           std::list<CommandServer*>::iterator it = mCommandServerList.begin();
+           std::list<CommandServer*>::const_iterator it = mCommandServerList.begin();
            for(;it!=mCommandServerList.end();it++)
            {
               (*it)->buildFdSet(fdset);
diff --git a/repro/CommandServerThread.hxx b/repro/CommandServerThread.hxx
index 5e8f242..abdb0e7 100644
--- a/repro/CommandServerThread.hxx
+++ b/repro/CommandServerThread.hxx
@@ -18,7 +18,7 @@ protected:
 
 private:
    virtual void thread();
-   std::list<CommandServer*> mCommandServerList;
+   const std::list<CommandServer*>& mCommandServerList;
 };
 
 }
diff --git a/repro/HttpBase.cxx b/repro/HttpBase.cxx
index 244c578..4f0ffc4 100644
--- a/repro/HttpBase.cxx
+++ b/repro/HttpBase.cxx
@@ -174,7 +174,10 @@ HttpBase::process(FdSet& fdset)
          int e = getErrno();
          switch (e)
          {
-            case EWOULDBLOCK:
+            case EAGAIN:
+#if EAGAIN != EWOULDBLOCK
+            case EWOULDBLOCK:  // Treat EGAIN and EWOULDBLOCK as the same: http://stackoverflow.com/questions/7003234/which-systems-define-eagain-and-ewouldblock-as-different-values
+#endif
                // !jf! this can not be ready in some cases 
                return;
             default:
diff --git a/repro/RegSyncClient.cxx b/repro/RegSyncClient.cxx
index 2b9e7a6..1a5a566 100644
--- a/repro/RegSyncClient.cxx
+++ b/repro/RegSyncClient.cxx
@@ -93,7 +93,8 @@ RegSyncClient::thread()
       mSocketDesc = (int)socket(servAddr.ipVersion() == V6 ? PF_INET6 : PF_INET , SOCK_STREAM, 0);
       if(mSocketDesc < 0) 
       {
-         ErrLog(<< "RegSyncClient: cannot open socket");
+         int e = getErrno();
+         ErrLog(<< "RegSyncClient: cannot open socket, err=" << e);
          mSocketDesc = 0;
          return;
       }
@@ -102,7 +103,8 @@ RegSyncClient::thread()
       rc = ::bind(mSocketDesc, &localAddr.getMutableSockaddr(), localAddr.length());
       if(rc < 0) 
       {
-         ErrLog(<<"RegSyncClient: error binding locally");
+         int e = getErrno();
+         ErrLog(<<"RegSyncClient: error binding locally, err=" << e);
          closeSocket(mSocketDesc);
          mSocketDesc = 0;
          return;
@@ -112,7 +114,8 @@ RegSyncClient::thread()
       rc = ::connect(mSocketDesc, &servAddr.getMutableSockaddr(), servAddr.length());
       if(rc < 0) 
       {
-         if(!mShutdown) ErrLog(<< "RegSyncClient: error connecting to " << mAddress << ":" << mPort);
+         int e = getErrno();
+         if(!mShutdown) ErrLog(<< "RegSyncClient: error connecting to " << mAddress << ":" << mPort << ", err=" << e);
          closeSocket(mSocketDesc);
          mSocketDesc = 0;
          delaySeconds(30);
@@ -128,7 +131,19 @@ RegSyncClient::thread()
       rc = ::send(mSocketDesc, request.c_str(), (int)request.size(), 0);
       if(rc < 0) 
       {
-         if(!mShutdown) ErrLog(<< "RegSyncClient: error sending");
+         int e = getErrno();
+         if(!mShutdown) ErrLog(<< "RegSyncClient: error sending, err=" << e);
+         closeSocket(mSocketDesc);
+         mSocketDesc = 0;
+         continue;
+      }
+
+      // Make socket non blocking
+      bool ok = makeSocketNonBlocking(mSocketDesc);
+      if (!ok)
+      {
+         int e = getErrno();
+         ErrLog(<< "RegSyncClient: Could not make HTTP socket non-blocking, err=" << e);
          closeSocket(mSocketDesc);
          mSocketDesc = 0;
          continue;
@@ -136,19 +151,58 @@ RegSyncClient::thread()
 
       while(rc > 0)
       {
-         rc = ::recv(mSocketDesc, (char*)&mRxBuffer, sizeof(mRxBuffer), 0);
-         if(rc < 0) 
+         FdSet fdset;
+         fdset.setRead(mSocketDesc);
+         fdset.setExcept(mSocketDesc);
+         timeval tm;
+         tm.tv_sec = 30; // TODO - make a setting?
+         tm.tv_usec = 0;
+         rc = fdset.select(tm);
+         if(rc > 0)
+         {
+            rc = ::recv(mSocketDesc, (char*)&mRxBuffer, sizeof(mRxBuffer), 0);
+            if(rc < 0) 
+            {
+                int e = getErrno();
+                if(!mShutdown) ErrLog(<< "RegSyncClient: error receiving, err=" << e);
+                closeSocket(mSocketDesc);
+                mSocketDesc = 0;
+                break;
+            }
+            
+            if(rc > 0)
+            {
+                mRxDataBuffer += Data(Data::Borrow, (const char*)&mRxBuffer, rc);   
+                while(tryParse());
+            }
+         }
+         else if(rc == 0) // timeout - send keepalive
          {
-            if(!mShutdown) ErrLog(<< "RegSyncClient: error receiving");
-            closeSocket(mSocketDesc);
-            mSocketDesc = 0;
-            break;
+            rc = ::send(mSocketDesc, Symbols::CRLFCRLF, (int)request.size(), 0);
+            if(rc < 0) 
+            {
+               int e = getErrno();
+               // If send is blocking then we must have pending send data - so just ignore error - no need to keepalive
+               if ( e != EAGAIN && e != EWOULDBLOCK ) // Treat EGAIN and EWOULDBLOCK as the same: http://stackoverflow.com/questions/7003234/which-systems-define-eagain-and-ewouldblock-as-different-values
+               {
+                  if(!mShutdown) ErrLog(<< "RegSyncClient: error sending keepalive, err=" << e);
+                  closeSocket(mSocketDesc);
+                  mSocketDesc = 0;
+                  continue;
+               }
+            }
+            //else
+            //{
+            //    InfoLog( << "RegSyncClient: keepalive sent!");
+            //}
          }
-
-         if(rc > 0)
+         else
          {
-            mRxDataBuffer += Data(Data::Borrow, (const char*)&mRxBuffer, rc);   
-            while(tryParse());
+             int e = getErrno();
+             if(!mShutdown) ErrLog(<< "RegSyncClient: error calling select, err=" << e);
+             closeSocket(mSocketDesc);
+             mSocketDesc = 0;
+             break;
          }
       }
    } // end while
@@ -369,6 +423,8 @@ RegSyncClient::processModify(const resip::Uri& aor, ContactList& syncContacts)
    bool found;
    for(; itSync != syncContacts.end(); itSync++)
    {
+       InfoLog(<< "  RegSyncClient::processModify: contact=" << itSync->mContact << ", instance=" << itSync->mInstance << ", regid=" << itSync->mRegId);
+
        // See if contact already exists in currentContacts       
        found = false;
        for(itCurrent = currentContacts.begin(); itCurrent != currentContacts.end(); itCurrent++)
diff --git a/repro/RegSyncServerThread.cxx b/repro/RegSyncServerThread.cxx
index abf019f..ee91298 100644
--- a/repro/RegSyncServerThread.cxx
+++ b/repro/RegSyncServerThread.cxx
@@ -2,7 +2,6 @@
 #include <rutil/Logger.hxx>
 
 #include "repro/RegSyncServer.hxx"
-#include "repro/RegSyncClient.hxx"
 #include "repro/RegSyncServerThread.hxx"
 
 #define RESIPROCATE_SUBSYSTEM Subsystem::REPRO
diff --git a/repro/ReproRunner.cxx b/repro/ReproRunner.cxx
index 8b3c8ce..929392b 100644
--- a/repro/ReproRunner.cxx
+++ b/repro/ReproRunner.cxx
@@ -142,7 +142,6 @@ ReproRunner::ReproRunner()
    , mLemurs(0)
    , mBaboons(0)
    , mProxy(0)
-   , mWebAdminList(0)
    , mWebAdminThread(0)
    , mRegistrar(0)
    , mDum(0)
@@ -152,7 +151,6 @@ ReproRunner::ReproRunner()
    , mRegSyncServerV4(0)
    , mRegSyncServerV6(0)
    , mRegSyncServerThread(0)
-   , mCommandServerList(0)
    , mCommandServerThread(0)
    , mCongestionManager(0)
 {
@@ -410,11 +408,11 @@ ReproRunner::cleanupObjects()
    {
       // We leave command server running during restart
       delete mCommandServerThread; mCommandServerThread = 0;
-      for(std::list<CommandServer*>::iterator it = mCommandServerList->begin(); it != mCommandServerList->end(); it++)
+      for(std::list<CommandServer*>::iterator it = mCommandServerList.begin(); it != mCommandServerList.end(); it++)
       {
          delete (*it);
       }
-      delete mCommandServerList; mCommandServerList = 0;
+      mCommandServerList.clear();
    }
    delete mRegSyncServerThread; mRegSyncServerThread = 0;
    delete mRegSyncServerV6; mRegSyncServerV6 = 0;
@@ -427,11 +425,11 @@ ReproRunner::cleanupObjects()
    delete mDum; mDum = 0;
    delete mRegistrar; mRegistrar = 0;
    delete mWebAdminThread; mWebAdminThread = 0;
-   for(std::list<WebAdmin*>::iterator it = mWebAdminList->begin(); it != mWebAdminList->end(); it++)
+   for(std::list<WebAdmin*>::iterator it = mWebAdminList.begin(); it != mWebAdminList.end(); it++)
    {
       delete (*it);
    }
-   delete mWebAdminList; mWebAdminList = 0;
+   mWebAdminList.clear();
    delete mProxy; mProxy = 0;
    delete mBaboons; mBaboons = 0;
    delete mLemurs; mLemurs = 0;
@@ -636,6 +634,9 @@ ReproRunner::createSipStack()
       mSipStack->setEnumDomains(enumDomains);
    }
 
+   // Add External Stats handler
+   mSipStack->setExternalStatsHandler(this);
+
    // Add stack transports
    bool allTransportsSpecifyRecordRoute=false;
    if(!addTransports(allTransportsSpecifyRecordRoute))
@@ -996,6 +997,17 @@ ReproRunner::createProxy()
    Data defaultRealm = addDomains(*mProxy, true);
    mHttpRealm = mProxyConfig->getConfigData("HttpAdminRealm", defaultRealm);
 
+   // Set Server Text
+#ifdef PACKAGE_VERSION
+   Data serverText(mProxyConfig->getConfigData("ServerText", "repro " PACKAGE_VERSION));
+#else
+   Data serverText(mProxyConfig->getConfigData("ServerText", ""));
+#endif
+   if(!serverText.empty())
+   {
+      mProxy->setServerText(serverText);
+   }
+
    // Register the Proxy class a stack transaction user
    // Note:  This is done after creating the DialogUsageManager so that it acts 
    // like a catchall and will handle all requests the DUM does not
@@ -1043,14 +1055,13 @@ ReproRunner::populateRegistrations()
 bool
 ReproRunner::createWebAdmin()
 {
-   assert(!mWebAdminList);
+   assert(mWebAdminList.empty());
    assert(!mWebAdminThread);
 
    std::vector<resip::Data> httpServerBindAddresses;
    mProxyConfig->getConfigValue("HttpBindAddress", httpServerBindAddresses);
    int httpPort = mProxyConfig->getConfigInt("HttpPort", 5080);
 
-   mWebAdminList = new std::list<WebAdmin*>;
    if(httpPort)
    {
       if(httpServerBindAddresses.empty())
@@ -1069,48 +1080,70 @@ ReproRunner::createWebAdmin()
       {
          if(mUseV4 && DnsUtil::isIpV4Address(*it)) 
          {
-            WebAdmin* WebAdminV4 = new WebAdmin(*mProxy,
-                                                *mRegistrationPersistenceManager, 
-                                                mHttpRealm, 
-                                                httpPort,
-                                                V4,
-                                                *it);
-
-            if (!WebAdminV4->isSane())
+            WebAdmin* webAdminV4 = 0;
+
+            try 
+            {
+               webAdminV4 = new WebAdmin(*mProxy,
+                                         *mRegistrationPersistenceManager, 
+                                         mHttpRealm, 
+                                         httpPort,
+                                         V4,
+                                         *it);
+            } 
+            catch(WebAdmin::ConfigException& ex) 
+            {
+               ErrLog(<<"Exception when starting WebAdmin: " << ex.getMessage());
+               webAdminV4 = 0;
+            }
+
+            if (!webAdminV4 || !webAdminV4->isSane())
             {
                CritLog(<<"Failed to start WebAdminV4");
+               delete webAdminV4;
                cleanupObjects();
                return false;
             }
 
-            mWebAdminList->push_back(WebAdminV4);
+            mWebAdminList.push_back(webAdminV4);
          }
 
          if(mUseV6 && DnsUtil::isIpV6Address(*it)) 
          {
-            WebAdmin* WebAdminV6 = new WebAdmin(*mProxy,
-                                                *mRegistrationPersistenceManager, 
-                                                mHttpRealm, 
-                                                httpPort,
-                                                V6,
-                                                *it);
-
-            if (!WebAdminV6->isSane())
+            WebAdmin* webAdminV6 = 0;
+
+            try 
+            {
+               webAdminV6 = new WebAdmin(*mProxy,
+                                         *mRegistrationPersistenceManager, 
+                                         mHttpRealm, 
+                                         httpPort,
+                                         V6,
+                                         *it);
+            } 
+            catch(WebAdmin::ConfigException& ex) 
+            {
+               ErrLog(<<"Exception when starting WebAdmin: " << ex.getMessage());
+               webAdminV6 = 0;
+            }
+
+            if (!webAdminV6 || !webAdminV6->isSane())
             {
                CritLog(<<"Failed to start WebAdminV6");
+               delete webAdminV6;
                cleanupObjects();
                return false;
             }
 
-            mWebAdminList->push_back(WebAdminV6);
+            mWebAdminList.push_back(webAdminV6);
          }
       }
 
       // This shouldn't happen because it would return false before
       // it reached this point
-      if(!mWebAdminList->empty())
+      if(!mWebAdminList.empty())
       {
-         mWebAdminThread = new WebAdminThread(*mWebAdminList);
+         mWebAdminThread = new WebAdminThread(mWebAdminList);
          return true;
       }
    }
@@ -1154,14 +1187,13 @@ ReproRunner::createRegSync()
 void
 ReproRunner::createCommandServer()
 {
-   assert(!mCommandServerList);
+   assert(mCommandServerList.empty());
    assert(!mCommandServerThread);
 
    std::vector<resip::Data> commandServerBindAddresses;
    mProxyConfig->getConfigValue("CommandBindAddress", commandServerBindAddresses);
    int commandPort = mProxyConfig->getConfigInt("CommandPort", 5081);
 
-   mCommandServerList = new std::list<CommandServer*>;
    if(commandPort != 0)
    {
       if(commandServerBindAddresses.empty())
@@ -1180,36 +1212,38 @@ ReproRunner::createCommandServer()
       {
          if(mUseV4 && DnsUtil::isIpV4Address(*it))
          {
-            CommandServer* CommandServerV4 = new CommandServer(*this, *it, commandPort, V4);
+            CommandServer* pCommandServerV4 = new CommandServer(*this, *it, commandPort, V4);
 
-            if(CommandServerV4->isSane())
+            if(pCommandServerV4->isSane())
             {
-               mCommandServerList->push_back(CommandServerV4);
+               mCommandServerList.push_back(pCommandServerV4);
             }
             else
             {
                CritLog(<<"Failed to start CommandServerV4");
+               delete pCommandServerV4;
             }
          }
 
          if(mUseV6 && DnsUtil::isIpV6Address(*it))
          {
-            CommandServer* CommandServerV6 = new CommandServer(*this, *it, commandPort, V6);
+            CommandServer* pCommandServerV6 = new CommandServer(*this, *it, commandPort, V6);
 
-            if(CommandServerV6->isSane())
+            if(pCommandServerV6->isSane())
             {
-               mCommandServerList->push_back(CommandServerV6);
+               mCommandServerList.push_back(pCommandServerV6);
             }
             else
             {
                CritLog(<<"Failed to start CommandServerV6");
+               delete pCommandServerV6;
             }
          }
       }
 
-      if(!mCommandServerList->empty())
+      if(!mCommandServerList.empty())
       {
-         mCommandServerThread = new CommandServerThread(*mCommandServerList);
+         mCommandServerThread = new CommandServerThread(mCommandServerList);
       }
    }
 }
@@ -1705,6 +1739,16 @@ ReproRunner::makeTargetProcessorChain(ProcessorChain& chain)
    addProcessor(chain, std::auto_ptr<Processor>(new SimpleTargetHandler)); 
 }
 
+bool 
+ReproRunner::operator()(resip::StatisticsMessage &statsMessage)
+{
+   // Dispatch to each command server
+   for(std::list<CommandServer*>::iterator it = mCommandServerList.begin(); it != mCommandServerList.end(); it++)
+   {
+       (*it)->handleStatisticsMessage(statsMessage);
+   }
+   return true;
+}
 
 /* ====================================================================
  * The Vovida Software License, Version 1.0 
diff --git a/repro/ReproRunner.hxx b/repro/ReproRunner.hxx
index e223f54..7f97c8d 100644
--- a/repro/ReproRunner.hxx
+++ b/repro/ReproRunner.hxx
@@ -4,11 +4,13 @@
 #include "rutil/Data.hxx"
 #include "rutil/ServerProcess.hxx"
 #include "resip/dum/TlsPeerAuthManager.hxx"
+#include "resip/stack/StatisticsHandler.hxx"
 #include <memory>
 
 #include "repro/AuthenticatorFactory.hxx"
 #include "repro/Plugin.hxx"
 
+
 namespace resip
 {
    class TransactionUser;
@@ -40,7 +42,9 @@ class CommandServer;
 class CommandServerThread;
 class Processor;
 
-class ReproRunner : public resip::ServerProcess
+class ReproRunner : public resip::ServerProcess,
+                    public resip::ExternalStatsHandler
+
 {
 public:
    ReproRunner();
@@ -53,6 +57,9 @@ public:
 
    virtual Proxy* getProxy() { return mProxy; }
 
+   // External Stats handler
+   virtual bool operator()(resip::StatisticsMessage &statsMessage);
+
 protected:
    virtual void cleanupObjects();
 
@@ -98,7 +105,7 @@ protected:
    ProcessorChain* mLemurs;
    ProcessorChain* mBaboons;
    Proxy* mProxy;
-   std::list<WebAdmin*>* mWebAdminList;
+   std::list<WebAdmin*> mWebAdminList;
    WebAdminThread* mWebAdminThread;
    Registrar* mRegistrar;
    resip::DialogUsageManager* mDum;
@@ -108,7 +115,7 @@ protected:
    RegSyncServer* mRegSyncServerV4;
    RegSyncServer* mRegSyncServerV6;
    RegSyncServerThread* mRegSyncServerThread;
-   std::list<CommandServer*>* mCommandServerList;
+   std::list<CommandServer*> mCommandServerList;
    CommandServerThread* mCommandServerThread;
    resip::CongestionManager* mCongestionManager;
    std::vector<Plugin*> mPlugins;
diff --git a/repro/WebAdminThread.cxx b/repro/WebAdminThread.cxx
index bd8ae00..5c052b1 100644
--- a/repro/WebAdminThread.cxx
+++ b/repro/WebAdminThread.cxx
@@ -12,12 +12,11 @@ using namespace repro;
 using namespace std;
 
 
-WebAdminThread::WebAdminThread(const std::list<WebAdmin*>& WebAdminList)
-   : mWebAdminList(WebAdminList)
+WebAdminThread::WebAdminThread(const std::list<WebAdmin*>& webAdminList)
+   : mWebAdminList(webAdminList)
 {
 }
 
-
 void
 WebAdminThread::thread()
 {
@@ -27,7 +26,7 @@ WebAdminThread::thread()
       {
            FdSet fdset;
            
-           std::list<WebAdmin*>::iterator it = mWebAdminList.begin();
+           std::list<WebAdmin*>::const_iterator it = mWebAdminList.begin();
            for(;it!=mWebAdminList.end();it++)
            {
               (*it)->buildFdSet(fdset);
diff --git a/repro/WebAdminThread.hxx b/repro/WebAdminThread.hxx
index 8ea997a..1578703 100644
--- a/repro/WebAdminThread.hxx
+++ b/repro/WebAdminThread.hxx
@@ -21,7 +21,7 @@ class WebAdminThread : public resip::ThreadIf
       //  virtual unsigned int getTimeTillNextProcessMS() const;
 
    private:
-      std::list<WebAdmin*> mWebAdminList;
+      const std::list<WebAdmin*>& mWebAdminList;
 };
 
 }
diff --git a/repro/XmlRpcServerBase.cxx b/repro/XmlRpcServerBase.cxx
index 53e802b..ad0c0d6 100644
--- a/repro/XmlRpcServerBase.cxx
+++ b/repro/XmlRpcServerBase.cxx
@@ -203,7 +203,10 @@ XmlRpcServerBase::process(FdSet& fdset)
          int e = getErrno();
          switch (e)
          {
-            case EWOULDBLOCK:
+            case EAGAIN:
+#if EAGAIN != EWOULDBLOCK
+            case EWOULDBLOCK:  // Treat EGAIN and EWOULDBLOCK as the same: http://stackoverflow.com/questions/7003234/which-systems-define-eagain-and-ewouldblock-as-different-values
+#endif
                return;
             default:
                logSocketError(e);
diff --git a/repro/reprocmd/reprocmd.cpp b/repro/reprocmd/reprocmd.cpp
index 05329dc..f54a5e2 100644
--- a/repro/reprocmd/reprocmd.cpp
+++ b/repro/reprocmd/reprocmd.cpp
@@ -185,7 +185,7 @@ main (int argc, char** argv)
                   }
                   if(xml.firstChild())
                   {
-                     text = xml.getValue();
+                     text = xml.getValue().xmlCharDataDecode();
                      xml.parent();
                   }
                   if(code >= 200 && code < 300)
diff --git a/resip/stack/TcpBaseTransport.cxx b/resip/stack/TcpBaseTransport.cxx
index c9400d1..356a6bb 100644
--- a/resip/stack/TcpBaseTransport.cxx
+++ b/resip/stack/TcpBaseTransport.cxx
@@ -153,7 +153,10 @@ TcpBaseTransport::processListen()
          int e = getErrno();
          switch (e)
          {
-            case EWOULDBLOCK:
+            case EAGAIN:
+#if EAGAIN != EWOULDBLOCK
+            case EWOULDBLOCK:  // Treat EGAIN and EWOULDBLOCK as the same: http://stackoverflow.com/questions/7003234/which-systems-define-eagain-and-ewouldblock-as-different-values
+#endif
                // !jf! this can not be ready in some cases
                // !kw! this will happen every epoll cycle
                return 0;
@@ -245,7 +248,10 @@ TcpBaseTransport::makeOutgoingConnection(const Tuple &dest,
       switch (err)
       {
          case EINPROGRESS:
-         case EWOULDBLOCK:
+         case EAGAIN:
+#if EAGAIN != EWOULDBLOCK
+         case EWOULDBLOCK:  // Treat EGAIN and EWOULDBLOCK as the same: http://stackoverflow.com/questions/7003234/which-systems-define-eagain-and-ewouldblock-as-different-values
+#endif
             break;
          default:
          {
diff --git a/resip/stack/WsDecorator.cxx b/resip/stack/WsDecorator.cxx
index bb5cb76..64e9aca 100644
--- a/resip/stack/WsDecorator.cxx
+++ b/resip/stack/WsDecorator.cxx
@@ -3,7 +3,7 @@
 #include "SipMessage.hxx"
 #include "Tuple.hxx"
 #include "Transport.hxx"
-
+#include "rutil/WinLeakCheck.hxx"
 
 using namespace std;
 using namespace resip;
diff --git a/resip/stack/WsFrameExtractor.cxx b/resip/stack/WsFrameExtractor.cxx
index 4dffe37..a939efe 100644
--- a/resip/stack/WsFrameExtractor.cxx
+++ b/resip/stack/WsFrameExtractor.cxx
@@ -1,6 +1,7 @@
 
 #include "rutil/Logger.hxx"
 #include "resip/stack/WsFrameExtractor.hxx"
+#include "rutil/WinLeakCheck.hxx"
 
 using namespace resip;
 
diff --git a/resip/stack/ssl/Security.cxx b/resip/stack/ssl/Security.cxx
index 87bdf70..c2bc64e 100644
--- a/resip/stack/ssl/Security.cxx
+++ b/resip/stack/ssl/Security.cxx
@@ -1124,7 +1124,7 @@ BaseSecurity::addDomainCertPEM(const Data& domainName, const Data& certPEM)
 void
 BaseSecurity::addDomainCertDER(const Data& domainName, const Data& certDER)
 {
-   addCertDER(DomainCert, domainName, certDER, true);
+   addCertDER(DomainCert, domainName, certDER, false);
 }
 
 
@@ -1152,7 +1152,7 @@ BaseSecurity::getDomainCertDER(const Data& domainName) const
 void
 BaseSecurity::addDomainPrivateKeyPEM(const Data& domainName, const Data& privateKeyPEM)
 {
-   addPrivateKeyPEM(DomainPrivateKey, domainName, privateKeyPEM, true);
+   addPrivateKeyPEM(DomainPrivateKey, domainName, privateKeyPEM, false);
 }
 
 
@@ -1180,14 +1180,14 @@ BaseSecurity::getDomainPrivateKeyPEM(const Data& domainName) const
 void
 BaseSecurity::addUserCertPEM(const Data& aor, const Data& certPEM)
 {
-   addCertPEM(UserCert, aor, certPEM, true);
+   addCertPEM(UserCert, aor, certPEM, false);
 }
 
 
 void
 BaseSecurity::addUserCertDER(const Data& aor, const Data& certDER)
 {
-   addCertDER(UserCert, aor, certDER, true);
+   addCertDER(UserCert, aor, certDER, false);
 }
 
 
@@ -1275,14 +1275,14 @@ BaseSecurity::getUserPassPhrase(const Data& aor) const
 void
 BaseSecurity::addUserPrivateKeyPEM(const Data& aor, const Data& cert)
 {
-   addPrivateKeyPEM(UserPrivateKey, aor, cert, true);
+   addPrivateKeyPEM(UserPrivateKey, aor, cert, false);
 }
 
 
 void
 BaseSecurity::addUserPrivateKeyDER(const Data& aor, const Data& cert)
 {
-   addPrivateKeyDER(UserPrivateKey, aor, cert, true);
+   addPrivateKeyDER(UserPrivateKey, aor, cert, false);
 }
 
 
diff --git a/resiprocate.spec b/resiprocate.spec
index da1b510..421826a 100644
--- a/resiprocate.spec
+++ b/resiprocate.spec
@@ -1,5 +1,5 @@
 Name: resiprocate
-Version: 1.9.0
+Version: 1.9.1
 Release: 1%{?dist}
 Summary: SIP and TURN stacks, with SIP proxy and TURN server implementations
 License: VSL
@@ -367,7 +367,7 @@ rm -rf $RPM_BUILD_ROOT
 %{_sbindir}/presSvr
 
 %changelog
-* Sat Nov 24 2012 Daniel Pocock <daniel at pocock.com.au> - 1.9.0-1
+* Sat Nov 24 2012 Daniel Pocock <daniel at pocock.com.au> - 1.9.1-1
 - Produce multiple packages for stack/libs, daemons, sipdialer
 - Initial build based on autotools
 
diff --git a/rutil/Log.cxx b/rutil/Log.cxx
index ca7f20a..2bba311 100644
--- a/rutil/Log.cxx
+++ b/rutil/Log.cxx
@@ -413,6 +413,7 @@ Log::timestamp(Data& res)
    GetLocalTime(&systemTime);
    tv.tv_usec = systemTime.wMilliseconds * 1000; 
 #else 
+   struct tm localTimeResult;
    struct timeval tv; 
    int result = gettimeofday (&tv, NULL);
 #endif   
@@ -434,7 +435,11 @@ Log::timestamp(Data& res)
                 datebufSize,
                 "%Y%m%d-%H%M%S", /* guaranteed to fit in 256 chars,
                                     hence don't check return code */
-                localtime (&timeInSeconds));
+#ifdef WIN32
+                localtime (&timeInSeconds));  // Thread safe call on Windows
+#else
+                localtime_r (&timeInSeconds, &localTimeResult));  // Thread safe version of localtime on linux
+#endif
    }
    
    char msbuf[5];
diff --git a/rutil/SelectInterruptor.cxx b/rutil/SelectInterruptor.cxx
index 9afec19..ad788da 100644
--- a/rutil/SelectInterruptor.cxx
+++ b/rutil/SelectInterruptor.cxx
@@ -118,13 +118,16 @@ SelectInterruptor::interrupt()
    assert(count == sizeof(wakeUp));
 #else
    ssize_t res = write(mPipe[1], wakeUp, sizeof(wakeUp));
-   if ( res == -1 && errno==EAGAIN )
+
+   if ( res == -1 && (errno == EAGAIN || errno == EWOULDBLOCK) )   // Treat EGAIN and EWOULDBLOCK as the same: http://stackoverflow.com/questions/7003234/which-systems-define-eagain-and-ewouldblock-as-different-values
    {
       ; // this can happen when SipStack thread gets behind.
       // no need to block since our only purpose is to wake up the thread
       // also, this write can occur within the SipStack thread, in which
       // case we get dead-lock if this blocks
-   } else {
+   } 
+   else 
+   {
       assert(res == sizeof(wakeUp));
    }
 #endif
diff --git a/rutil/dns/AresDns.cxx b/rutil/dns/AresDns.cxx
index 06e7fdc..efbde55 100644
--- a/rutil/dns/AresDns.cxx
+++ b/rutil/dns/AresDns.cxx
@@ -9,6 +9,7 @@
 
 #include "rutil/dns/AresDns.hxx"
 #include "rutil/GenericIPAddress.hxx"
+#include "rutil/Timer.hxx"
 
 #include "AresCompat.hxx"
 #if !defined(USE_CARES)
@@ -55,7 +56,10 @@ class AresDnsPollItem : public FdPollItemBase
    virtual void	processPollEvent(FdPollEventMask mask);
    void resetPollGrp(FdPollGrp *grp)
    {
-      mPollGrp->delPollItem(mPollHandle);
+      if(mPollGrp)
+      {
+         mPollGrp->delPollItem(mPollHandle);
+      }
       mPollHandle = 0;
       mPollGrp = grp;
       if(mPollGrp)
@@ -599,6 +603,9 @@ unsigned int
 AresDns::getTimeTillNextProcessMS()
 {
    struct timeval tv;
+   unsigned maxSystemTime = resip::Timer::getMaxSystemTimeWaitMs();
+   tv.tv_sec = maxSystemTime / 1000;
+   tv.tv_usec = 1000 * (maxSystemTime % 1000);
    ares_timeout(mChannel, NULL, &tv);
    return tv.tv_sec*1000 + tv.tv_usec / 1000;
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-voip/resiprocate.git



More information about the Pkg-voip-commits mailing list