forked from Mirrors/openclonk
C4NetIOUDP: Fix sending data before ConnOK
With my fix from 9eb2478b2
("C4NetIOUDP: Fix timeout during non-MC
connection"), C4NetIOUDP would send data packets to the master server
before the ConnOK packet. The server would then discard these data
packets, resulting in a one-second delay until retransmission.
install-platforms
parent
e324289f8d
commit
3476d76e61
|
@ -3259,6 +3259,7 @@ void C4NetIOUDP::Peer::OnRecv(const C4NetIOPacket &rPacket) // (mt-safe)
|
|||
}
|
||||
// build ConnOk Packet
|
||||
ConnOKPacket nPack;
|
||||
bool fullyConnected = false;
|
||||
|
||||
nPack.StatusByte = IPID_ConnOK; // (always du, no mc experiments here)
|
||||
nPack.Nr = fBroadcasted ? pParent->iOPacketCounter : iOPacketCounter;
|
||||
|
@ -3271,10 +3272,12 @@ void C4NetIOUDP::Peer::OnRecv(const C4NetIOPacket &rPacket) // (mt-safe)
|
|||
{
|
||||
nPack.MCMode = ConnOKPacket::MCM_NoMC; // du ok
|
||||
// no multicast => we're fully connected now
|
||||
OnConn();
|
||||
fullyConnected = true;
|
||||
}
|
||||
// send it
|
||||
SendDirect(C4NetIOPacket(&nPack, sizeof(nPack), false, addr));
|
||||
// Clients will try sending data from OnConn, so send ConnOK before that.
|
||||
if (fullyConnected) OnConn();
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in New Issue