[asterisk-scf-commits] asterisk-scf/release/logger.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Mon Jan 3 15:18:30 UTC 2011


branch "master" has been updated
       via  296b0194c1b37f5b54db610716d20553cef9564f (commit)
       via  89b93578b469ad254ea3d6f9bc98d2e0b0e3fa90 (commit)
       via  40db741c9c3c91f88e35860f4f3ddc5fd0f06c7f (commit)
       via  33154ba785ef6b6278b5840119d5b89415bdf6ae (commit)
       via  87f836dfb3fa0b01f675a54ce57ed3d4720d2d69 (commit)
       via  8e465e884056bad4c1ac19fead38a8ce6b25ad5d (commit)
      from  9f04ff8250a49f6185a58c30f681427f26b617ff (commit)

Summary of changes:
 client/src/IceConfigurator.cpp       |    8 +++-----
 client/src/IceLogger.cpp             |   16 ++++++++++++----
 client/src/IceLogger.h               |    4 ++--
 client/src/Logger.cpp                |   12 +++++++++---
 client/test/IceConfigurator-test.cpp |    5 +++--
 5 files changed, 29 insertions(+), 16 deletions(-)


- Log -----------------------------------------------------------------
commit 296b0194c1b37f5b54db610716d20553cef9564f
Author: David M. Lee <dlee at digium.com>
Date:   Mon Jan 3 09:16:48 2011 -0600

    Improved IceConfigurator-test by not sorting inputs.
    
    See CR-ASTSCF-4.

diff --git a/client/test/IceConfigurator-test.cpp b/client/test/IceConfigurator-test.cpp
index 90d49e5..0ec8fef 100644
--- a/client/test/IceConfigurator-test.cpp
+++ b/client/test/IceConfigurator-test.cpp
@@ -43,10 +43,11 @@ BOOST_AUTO_TEST_CASE(test_simple)
     IceConfigurator uut(factory);
 
     Configuration cfg;
-    addConfig(cfg, "", Error);
+    // check logic for unordered inputs
     addConfig(cfg, "AsteriskSCF", Info);
-    addConfig(cfg, "AsteriskSCF.Core", Debug);
     addConfig(cfg, "AsteriskSCF.Media", Off);
+    addConfig(cfg, "AsteriskSCF.Core", Debug);
+    addConfig(cfg, "", Error);
 
     uut.configured(cfg);
 

commit 89b93578b469ad254ea3d6f9bc98d2e0b0e3fa90
Author: David M. Lee <dlee at digium.com>
Date:   Mon Jan 3 09:12:58 2011 -0600

    Made Logger::logf exception safe.
    
    See CR-ASTSCF-4.

diff --git a/client/src/Logger.cpp b/client/src/Logger.cpp
index 8c9059c..15b4d50 100644
--- a/client/src/Logger.cpp
+++ b/client/src/Logger.cpp
@@ -97,7 +97,15 @@ void Logger::logf(Level level, char const *fmt, ...) const
 {
     va_list ap;
     va_start(ap, fmt);
-    vlogf(level, fmt, ap);
+    try
+    {
+        vlogf(level, fmt, ap);
+    }
+    catch(...)
+    {
+        va_end(ap);
+        throw;
+    }
     va_end(ap);
 }
 

commit 40db741c9c3c91f88e35860f4f3ddc5fd0f06c7f
Author: David M. Lee <dlee at digium.com>
Date:   Sat Jan 1 04:18:06 2011 -0600

    Got rid of useless null termination of snprintf output.
    
    Must of crossed my strncpy with snprintf.
    See CR-ASTSCF-4.

diff --git a/client/src/Logger.cpp b/client/src/Logger.cpp
index d410834..8c9059c 100644
--- a/client/src/Logger.cpp
+++ b/client/src/Logger.cpp
@@ -107,8 +107,6 @@ void Logger::vlogf(Level level, char const *fmt, va_list ap) const
     {
         char message[MESSAGE_SIZE];
         vsnprintf(message, sizeof(message), fmt, ap);
-        // snprintf may not actually null terminate, so just in case
-        message[MESSAGE_SIZE - 1] = '\0';
         mOut->logs(mName, level, message);
     }
 }

commit 33154ba785ef6b6278b5840119d5b89415bdf6ae
Author: David M. Lee <dlee at digium.com>
Date:   Thu Dec 30 16:30:12 2010 -0600

    Fixed AMI blunder.
    
    I had written the locateFinished function, but never passed it to the
    begin_locate function.  :-(
    
    See CR-ASTSCF-4.

diff --git a/client/src/IceLogger.cpp b/client/src/IceLogger.cpp
index a608254..2a67f4b 100644
--- a/client/src/IceLogger.cpp
+++ b/client/src/IceLogger.cpp
@@ -78,7 +78,11 @@ void ConfiguredIceLogger::updateLoggerFromServiceLocator()
         // synchronous call to locate would result in a deadlock
         ServiceLocatorParamsPtr loggingServerParams =
             new ServiceLocatorParams(LoggingServerCategory);
-        mLocator->begin_locate(loggingServerParams);
+
+        Ice::CallbackPtr callback = Ice::newCallback(
+            this, &ConfiguredIceLogger::locateFinished);
+
+        mLocator->begin_locate(loggingServerParams, callback);
     }
 }
 
@@ -87,10 +91,14 @@ void ConfiguredIceLogger::locateFinished(const Ice::AsyncResultPtr& r)
     ServiceLocatorPrx locator = ServiceLocatorPrx::uncheckedCast(r->getProxy());
     try
     {
+        std::cout << "locate finished\n";
         Ice::ObjectPrx serverObject = locator->end_locate(r);
         if (serverObject)
         {
-            LoggingServerPrx server = LoggingServerPrx::checkedCast(
+            // XXX: the synchronous checkedCast call is causing a deadlock
+            // it's pretty safe to use an uncheckedCast, but not safe enough
+            // for me.
+            LoggingServerPrx server = LoggingServerPrx::uncheckedCast(
                 serverObject);
             mLogger.setServer(server);
         }

commit 87f836dfb3fa0b01f675a54ce57ed3d4720d2d69
Author: David M. Lee <dlee at digium.com>
Date:   Thu Dec 30 15:25:59 2010 -0600

    hasPrintedNoServerNotice -> mHasPrintedNoServerNotice
    
    See CR-ASTSCF-4.

diff --git a/client/src/IceLogger.cpp b/client/src/IceLogger.cpp
index 92cb0a4..a608254 100644
--- a/client/src/IceLogger.cpp
+++ b/client/src/IceLogger.cpp
@@ -48,8 +48,8 @@ void IceLogger::logs(const std::string& name, Level logLevel,
 
     if (!logged)
     {
-        if (!hasPrintedNoServerNotice) {
-            hasPrintedNoServerNotice = true;
+        if (!mHasPrintedNoServerNotice) {
+            mHasPrintedNoServerNotice = true;
             std::clog <<
                 "!!! Unable to log to server.  Please check configuration and server status.\n"
                 "!!! Logging to stderr instead.\n";
diff --git a/client/src/IceLogger.h b/client/src/IceLogger.h
index 87bc42e..a3ee3f7 100644
--- a/client/src/IceLogger.h
+++ b/client/src/IceLogger.h
@@ -27,7 +27,7 @@ namespace Logging
 class IceLogger : public LogOut
 {
 public:
-    IceLogger() : hasPrintedNoServerNotice(false) {}
+    IceLogger() : mHasPrintedNoServerNotice(false) {}
 
     void logs(const std::string& name, Level logLevel,
         const std::string& message);
@@ -37,7 +37,7 @@ public:
 
 private:
     LoggingServerPrx mServer;
-    bool hasPrintedNoServerNotice;
+    bool mHasPrintedNoServerNotice;
 };
 
 /**

commit 8e465e884056bad4c1ac19fead38a8ce6b25ad5d
Author: David M. Lee <dlee at digium.com>
Date:   Thu Dec 30 15:19:32 2010 -0600

    Fixed crossed reference in IceConfigurator.
    
    See CR-ASTSCF-4.

diff --git a/client/src/IceConfigurator.cpp b/client/src/IceConfigurator.cpp
index 508ff04..85c30cf 100644
--- a/client/src/IceConfigurator.cpp
+++ b/client/src/IceConfigurator.cpp
@@ -50,16 +50,14 @@ void IceConfigurator::configured(const Configuration& logConfiguration)
     std::sort(oldConfig.begin(), oldConfig.end());
     std::sort(newConfig.begin(), newConfig.end());
 
-    SourceConfigurationSeq::const_iterator newConfigIter =
-        logConfiguration.sourceSettings.begin();
+    SourceConfigurationSeq::const_iterator newConfigIter = newConfig.begin();
     std::vector<std::string>::const_iterator oldConfigIter = oldConfig.begin();
 
-    while (newConfigIter != logConfiguration.sourceSettings.end()
-        || oldConfigIter != oldConfig.end())
+    while (newConfigIter != newConfig.end() || oldConfigIter != oldConfig.end())
     {
         int cmp;
 
-        if (newConfigIter == logConfiguration.sourceSettings.end())
+        if (newConfigIter == newConfig.end())
         {
             // we ran out of new config; unset the rest of the old config
             // new[end] < old

-----------------------------------------------------------------------


-- 
asterisk-scf/release/logger.git



More information about the asterisk-scf-commits mailing list