/[resiprocate]/main/resip/dum/test/basicClientUserAgent.cxx
ViewVC logotype

Diff of /main/resip/dum/test/basicClientUserAgent.cxx

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 9011 by sgodin, Sun Feb 13 20:30:51 2011 UTC revision 9016 by sgodin, Wed Feb 16 18:06:10 2011 UTC
# Line 3  Line 3 
3  #include <rutil/DnsUtil.hxx>  #include <rutil/DnsUtil.hxx>
4  #include <resip/stack/SdpContents.hxx>  #include <resip/stack/SdpContents.hxx>
5  #include <resip/stack/ConnectionTerminated.hxx>  #include <resip/stack/ConnectionTerminated.hxx>
6    #include <resip/stack/Helper.hxx>
7  #include <resip/dum/AppDialogSetFactory.hxx>  #include <resip/dum/AppDialogSetFactory.hxx>
8  #include <resip/dum/ClientAuthManager.hxx>  #include <resip/dum/ClientAuthManager.hxx>
9  #include <resip/dum/KeepAliveManager.hxx>  #include <resip/dum/KeepAliveManager.hxx>
# Line 30  Line 31 
31    
32  #define RESIPROCATE_SUBSYSTEM Subsystem::TEST  #define RESIPROCATE_SUBSYSTEM Subsystem::TEST
33    
34    static unsigned int MaxRegistrationRetryTime = 1800;              // RFC5626 section 4.5 default
35    static unsigned int BaseRegistrationRetryTimeAllFlowsFailed = 30; // RFC5626 section 4.5 default
36    static unsigned int BaseRegistrationRetryTime = 90;               // RFC5626 section 4.5 default
37    
38  class ClientAppDialogSetFactory : public AppDialogSetFactory  class ClientAppDialogSetFactory : public AppDialogSetFactory
39  {  {
40  public:  public:
# Line 85  Line 90 
90     mDum(new DialogUsageManager(mStack)),     mDum(new DialogUsageManager(mStack)),
91     mStackThread(mStack, mSelectInterruptor),     mStackThread(mStack, mSelectInterruptor),
92     mDumShutdownRequested(false),     mDumShutdownRequested(false),
93     mDumShutdown(false)     mDumShutdown(false),
94       mRegistrationRetryDelayTime(0)
95  {  {
96     Log::initialize(mLogType, mLogLevel, argv[0]);     Log::initialize(mLogType, mLogLevel, argv[0]);
97    
# Line 357  Line 363 
363  {  {
364     InfoLog(<< "onSuccess(ClientRegistrationHandle): msg=" << msg.brief());     InfoLog(<< "onSuccess(ClientRegistrationHandle): msg=" << msg.brief());
365     mRegHandle = h;     mRegHandle = h;
366       mRegistrationRetryDelayTime = 0;  // reset
367  }  }
368    
369  void  void
# Line 376  Line 383 
383  int  int
384  BasicClientUserAgent::onRequestRetry(ClientRegistrationHandle h, int retryMinimum, const SipMessage& msg)  BasicClientUserAgent::onRequestRetry(ClientRegistrationHandle h, int retryMinimum, const SipMessage& msg)
385  {  {
    InfoLog(<< "onRequestRetry(ClientRegistrationHandle): msg=" << msg.brief());  
386     mRegHandle = h;     mRegHandle = h;
387     return -1;  // Let Profile retry setting take effect  
388       if(mRegistrationRetryDelayTime == 0)
389       {
390          mRegistrationRetryDelayTime = BaseRegistrationRetryTimeAllFlowsFailed; // We only have one flow in this test app
391       }
392    
393       // Use back off procedures of RFC 5626 section 4.5
394       mRegistrationRetryDelayTime = resipMin(MaxRegistrationRetryTime, mRegistrationRetryDelayTime * 2);
395    
396       // return an evenly distributed random number between 50% and 100% of mRegistrationRetryDelayTime
397       int retryTime = Helper::jitterValue(mRegistrationRetryDelayTime, 50, 100);
398       InfoLog(<< "onRequestRetry(ClientRegistrationHandle): msg=" << msg.brief() << ", retryTime=" << retryTime);
399    
400       return retryTime;
401  }  }
402    
403    

Legend:
Removed from v.9011  
changed lines
  Added in v.9016

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27