mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 14:59:47 +02:00
don't process packets in Connection without handshake
This commit is contained in:
parent
cabdee8391
commit
83d76084f1
2 changed files with 12 additions and 1 deletions
|
@ -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:
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue