handle double handshake in Connection

This commit is contained in:
Stephen Birarda 2015-08-27 14:27:29 -07:00
parent 3a918eedca
commit 1da9eeab1f

View file

@ -620,8 +620,12 @@ void Connection::processNAK(std::unique_ptr<ControlPacket> controlPacket) {
}
void Connection::processHandshake(std::unique_ptr<ControlPacket> controlPacket) {
// server sent us a handshake - we need to assume this means state should be reset
resetReceiveState();
if (!_hasReceivedHandshake || _hasReceivedFirstPacket) {
// server sent us a handshake - we need to assume this means state should be reset
// as long as we haven't received a handshake yet or we have and we've received some data
resetReceiveState();
}
// immediately respond with a handshake ACK
static auto handshakeACK = ControlPacket::create(ControlPacket::HandshakeACK, 0);