From 81a70135bd7bda6d97d77728131f4cbca7906d68 Mon Sep 17 00:00:00 2001 From: Adam Potolsky Date: Wed, 20 May 2015 13:50:18 -0700 Subject: [PATCH] Added concept of a max retry count to SecureSocket class #4650 --- src/lib/plugin/ns/SecureSocket.cpp | 7 +++++-- src/lib/plugin/ns/SecureSocket.h | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lib/plugin/ns/SecureSocket.cpp b/src/lib/plugin/ns/SecureSocket.cpp index dd2937ca..362bcce6 100644 --- a/src/lib/plugin/ns/SecureSocket.cpp +++ b/src/lib/plugin/ns/SecureSocket.cpp @@ -35,6 +35,7 @@ // #define MAX_ERROR_SIZE 65535 +#define MAX_RETRY_COUNT 60 static const char kFingerprintDirName[] = "SSL/Fingerprints"; //static const char kFingerprintLocalFilename[] = "Local.txt"; @@ -50,7 +51,8 @@ SecureSocket::SecureSocket( IEventQueue* events, SocketMultiplexer* socketMultiplexer) : TCPSocket(events, socketMultiplexer), - m_secureReady(false) + m_secureReady(false), + m_maxRetry(MAX_RETRY_COUNT) { } @@ -59,7 +61,8 @@ SecureSocket::SecureSocket( SocketMultiplexer* socketMultiplexer, ArchSocket socket) : TCPSocket(events, socketMultiplexer, socket), - m_secureReady(false) + m_secureReady(false), + m_maxRetry(MAX_RETRY_COUNT) { } diff --git a/src/lib/plugin/ns/SecureSocket.h b/src/lib/plugin/ns/SecureSocket.h index ba1f1df0..754956ca 100644 --- a/src/lib/plugin/ns/SecureSocket.h +++ b/src/lib/plugin/ns/SecureSocket.h @@ -50,6 +50,8 @@ public: UInt32 secureWrite(const void* buffer, UInt32 n); void initSsl(bool server); bool loadCertificates(String& CertFile); + void maxRetry(int limit) { m_maxRetry = limit; }; + int maxRetry() const { return m_maxRetry; }; private: // SSL @@ -78,4 +80,5 @@ private: private: Ssl* m_ssl; bool m_secureReady; + int m_maxRetry; };