[asterisk-scf-commits] asterisk-scf/integration/sip.git branch "safe_construct_w_pool" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Fri Jul 27 13:09:03 CDT 2012


branch "safe_construct_w_pool" has been updated
       via  751dc5af1f264b3c13a9ae7385ed21c669a3deab (commit)
       via  a872d4a38992c64a4ebecf880c202a761aabe474 (commit)
       via  34cf80f54a88569ae1894c2821d41d17945a324f (commit)
       via  e6b65c10643898b1ac0109a3f42bc3ef09753cbe (commit)
       via  dfa8647bf2e31c8de9cc0a7617049b061ed8ed9f (commit)
       via  288cdf2f20572064244732b8a897342fb9c3792a (commit)
      from  a6c9a6b1d8e3e1219d4509e18d8300fa2ec38aad (commit)

Summary of changes:
 src/PJSIPSessionModule.cpp |   10 +
 src/PJSIPSessionModule.h   |   16 ++
 src/SIPEndpoint.cpp        |   14 +-
 src/SIPSession.cpp         |  519 +++++++++++++++++++++++---------------------
 src/SIPSession.h           |   30 +++-
 5 files changed, 340 insertions(+), 249 deletions(-)


- Log -----------------------------------------------------------------
commit 751dc5af1f264b3c13a9ae7385ed21c669a3deab
Merge: a6c9a6b a872d4a
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Fri Jul 27 13:08:39 2012 -0500

    Merge branch 'x_safe_constructors' of git.asterisk.org:asterisk-scf/integration/sip into safe_construct_w_pool

diff --cc src/PJSIPSessionModule.cpp
index 07ac87c,5affc20..5110b70
--- a/src/PJSIPSessionModule.cpp
+++ b/src/PJSIPSessionModule.cpp
@@@ -2372,40 -2360,27 +2372,50 @@@ void PJSIPSessionModuleThreadPoolListen
      //XXX Making this behavior more customizable would be nice
      //
      //For now, what we do is kill all idle threads.
 -    if (idle > 0)
 +
 +    int poolSize = active + idle;
 +    int newPoolSize = poolSize; 
 +
 +    // Should we consider downsizing the pool?
 +    if (poolSize > mDefaultPoolSize)
      {
 -        lg(Debug) << "idle threads available, increasing pool size to match active threads. A: " << active << " I: " << idle;
 -        pool->setSize((int) active);
 +        // Are there any idle threads to shut down?
 +        if (idle > 0)
 +        {
 +           newPoolSize = std::max(mDefaultPoolSize, active);
 +           if (newPoolSize != poolSize)
 +           {
++              lg(Debug) << "Excess idle threads being shutdown. A: " << active << " I: " << idle << " default: " << mDefaultPoolSize;
++
 +               mActiveThreads = newPoolSize;
 +               pool->setSize(newPoolSize);
 +           }
 +        }
++	else
++	{
++            lg(Debug) << "No idle threads to shutdown. A: " << active << " default: " << mDefaultPoolSize;
++	}
+     }
+     else
+     { 
 -        lg(Debug) <<  "No current idle threads, the number of active threads is " << active;
++        lg(Debug) <<  "Pool size at default. Active: " << active;
      }
 -    mActiveThreads = active;
  }
  
 -void PJSIPSessionModuleThreadPoolListener::queueWorkAdded(const PoolPtr& pool, Ice::Long numNewWork, bool)
 +void PJSIPSessionModuleThreadPoolListener::queueWorkAdded(const PoolPtr& pool, Ice::Long numNewWork, Ice::Long newQueueSize)
  {
      //XXX Making this behavior more customizable would be nice
 -    //
 -    //For now, use one thread per work item.
  
 -    lg(Debug) << "Detected the addition of work to SIP's thread pool. Setting the size to " << mActiveThreads + numNewWork;
 -    int newSize = (int) (mActiveThreads + numNewWork);
 -    pool->setSize(newSize);
 +    if (mActiveThreads < mMaxPoolSize)
 +    {
 +        if (newQueueSize > mDefaultPoolSize && newQueueSize < mActiveThreads)
 +        {
 +            int newSize = std::min(mMaxPoolSize, newQueueSize);
 +            lg(Debug) << "SIP's thread pool queue size exceeds default threads. Setting pool size to " << newSize;
 +            mActiveThreads = newSize;
 +            pool->setSize(newSize);
 +        }
 +    }
  }
  
  void PJSIPSessionModuleThreadPoolListener::queueEmptied(const PoolPtr& pool)

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


-- 
asterisk-scf/integration/sip.git



More information about the asterisk-scf-commits mailing list