Added concept of a max retry count to SecureSocket class #4650

This commit is contained in:
Adam Potolsky 2015-05-20 13:50:18 -07:00
parent 994a9433fe
commit 81a70135bd
2 changed files with 8 additions and 2 deletions

View File

@ -35,6 +35,7 @@
// //
#define MAX_ERROR_SIZE 65535 #define MAX_ERROR_SIZE 65535
#define MAX_RETRY_COUNT 60
static const char kFingerprintDirName[] = "SSL/Fingerprints"; static const char kFingerprintDirName[] = "SSL/Fingerprints";
//static const char kFingerprintLocalFilename[] = "Local.txt"; //static const char kFingerprintLocalFilename[] = "Local.txt";
@ -50,7 +51,8 @@ SecureSocket::SecureSocket(
IEventQueue* events, IEventQueue* events,
SocketMultiplexer* socketMultiplexer) : SocketMultiplexer* socketMultiplexer) :
TCPSocket(events, socketMultiplexer), TCPSocket(events, socketMultiplexer),
m_secureReady(false) m_secureReady(false),
m_maxRetry(MAX_RETRY_COUNT)
{ {
} }
@ -59,7 +61,8 @@ SecureSocket::SecureSocket(
SocketMultiplexer* socketMultiplexer, SocketMultiplexer* socketMultiplexer,
ArchSocket socket) : ArchSocket socket) :
TCPSocket(events, socketMultiplexer, socket), TCPSocket(events, socketMultiplexer, socket),
m_secureReady(false) m_secureReady(false),
m_maxRetry(MAX_RETRY_COUNT)
{ {
} }

View File

@ -50,6 +50,8 @@ public:
UInt32 secureWrite(const void* buffer, UInt32 n); UInt32 secureWrite(const void* buffer, UInt32 n);
void initSsl(bool server); void initSsl(bool server);
bool loadCertificates(String& CertFile); bool loadCertificates(String& CertFile);
void maxRetry(int limit) { m_maxRetry = limit; };
int maxRetry() const { return m_maxRetry; };
private: private:
// SSL // SSL
@ -78,4 +80,5 @@ private:
private: private:
Ssl* m_ssl; Ssl* m_ssl;
bool m_secureReady; bool m_secureReady;
int m_maxRetry;
}; };