Merge pull request #49 from savisxss/main
This commit is contained in:
@@ -52,6 +52,7 @@ void DESC::Initialize()
|
|||||||
m_iHandshakeRetry = 0;
|
m_iHandshakeRetry = 0;
|
||||||
m_dwClientTime = 0;
|
m_dwClientTime = 0;
|
||||||
m_bHandshaking = false;
|
m_bHandshaking = false;
|
||||||
|
m_handshake_time = get_dword_time();
|
||||||
|
|
||||||
m_lpBufferedOutputBuffer = NULL;
|
m_lpBufferedOutputBuffer = NULL;
|
||||||
m_lpOutputBuffer = NULL;
|
m_lpOutputBuffer = NULL;
|
||||||
@@ -715,6 +716,14 @@ bool DESC::IsHandshaking()
|
|||||||
return m_bHandshaking;
|
return m_bHandshaking;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DESC::IsExpiredHandshake() const
|
||||||
|
{
|
||||||
|
if (m_handshake_time == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return (m_handshake_time + (5 * 1000)) < get_dword_time();
|
||||||
|
}
|
||||||
|
|
||||||
DWORD DESC::GetClientTime()
|
DWORD DESC::GetClientTime()
|
||||||
{
|
{
|
||||||
return m_dwClientTime;
|
return m_dwClientTime;
|
||||||
|
|||||||
@@ -174,6 +174,10 @@ class DESC
|
|||||||
bool isChannelStatusRequested() const { return m_bChannelStatusRequested; }
|
bool isChannelStatusRequested() const { return m_bChannelStatusRequested; }
|
||||||
void SetChannelStatusRequested(bool bChannelStatusRequested) { m_bChannelStatusRequested = bChannelStatusRequested; }
|
void SetChannelStatusRequested(bool bChannelStatusRequested) { m_bChannelStatusRequested = bChannelStatusRequested; }
|
||||||
|
|
||||||
|
// Handshake timeout check
|
||||||
|
bool IsExpiredHandshake() const;
|
||||||
|
void SetHandshakeTime(uint32_t handshake_time) { m_handshake_time = handshake_time; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void Initialize();
|
void Initialize();
|
||||||
|
|
||||||
@@ -246,6 +250,9 @@ class DESC
|
|||||||
bool m_bDestroyed;
|
bool m_bDestroyed;
|
||||||
bool m_bChannelStatusRequested;
|
bool m_bChannelStatusRequested;
|
||||||
|
|
||||||
|
// Handshake timeout protection
|
||||||
|
uint32_t m_handshake_time;
|
||||||
|
|
||||||
#ifdef _IMPROVED_PACKET_ENCRYPTION_
|
#ifdef _IMPROVED_PACKET_ENCRYPTION_
|
||||||
Cipher cipher_;
|
Cipher cipher_;
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -224,6 +224,18 @@ void DESC_MANAGER::DestroyClosed()
|
|||||||
DestroyDesc(d, false);
|
DestroyDesc(d, false);
|
||||||
m_set_pkDesc.erase(ci);
|
m_set_pkDesc.erase(ci);
|
||||||
}
|
}
|
||||||
|
else if (d->IsPhase(PHASE_HANDSHAKE))
|
||||||
|
{
|
||||||
|
if (d->GetType() == DESC_TYPE_ACCEPTOR)
|
||||||
|
{
|
||||||
|
if (d->IsExpiredHandshake())
|
||||||
|
{
|
||||||
|
sys_log(0, "[%s]: handshake session has expired!", d->GetHostName());
|
||||||
|
DestroyDesc(d, false);
|
||||||
|
m_set_pkDesc.erase(ci);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user