don't process packets in Connection without handshake

This commit is contained in:
Stephen Birarda 2015-08-25 17:14:41 -07:00
parent cabdee8391
commit 83d76084f1
2 changed files with 12 additions and 1 deletions

View file

@ -313,6 +313,11 @@ SequenceNumber Connection::nextACK() const {
bool Connection::processReceivedSequenceNumber(SequenceNumber sequenceNumber, int packetSize, int payloadSize) {
if (!_hasReceivedHandshake) {
// refuse to process any packets until we've received the handshake
return false;
}
_hasReceivedFirstPacket = true;
// check if this is a packet pair we should estimate bandwidth from, or just a regular packet
@ -382,6 +387,12 @@ bool Connection::processReceivedSequenceNumber(SequenceNumber sequenceNumber, in
}
void Connection::processControl(std::unique_ptr<ControlPacket> controlPacket) {
if (!_hasReceivedHandshake && controlPacket->getType() != ControlPacket::Handshake) {
// we refuse to process any packets until the handshake is received
return;
}
// Simple dispatch to control packets processing methods based on their type
switch (controlPacket->getType()) {
case ControlPacket::ACK:

View file

@ -63,7 +63,7 @@ public:
void sync(); // rate control method, fired by Socket for all connections on SYN interval
// return indicates if this packet was a duplicate
// return indicates if this packet should be processed
bool processReceivedSequenceNumber(SequenceNumber sequenceNumber, int packetSize, int payloadSize);
void processControl(std::unique_ptr<ControlPacket> controlPacket);