C4NetIOUDP: Fix timeout during non-MC connection

The "normal" connection process is a three-way handshake (Conn->,
<-Conn, ConnOK->). When establishing a multicast connection, this
handshake is repeated via the MC address. However, the code always
expected that second handshake to happen and thus ran into a timeout on
the client in the non-MC case, repeating the handshake a second time. In
the end, it usually still worked as the server supports reconnecting,
but packets may be lost in the process.
install-platforms
Lukas Werling 2017-12-02 18:47:42 +01:00
parent 2d4934e4dd
commit 9eb2478b2c
1 changed files with 4 additions and 0 deletions

View File

@ -3268,7 +3268,11 @@ void C4NetIOUDP::Peer::OnRecv(const C4NetIOPacket &rPacket) // (mt-safe)
else if (pParent->fMultiCast && addr.GetPort() == pParent->iPort)
nPack.MCMode = ConnOKPacket::MCM_MC; // du ok, try multicast next
else
{
nPack.MCMode = ConnOKPacket::MCM_NoMC; // du ok
// no multicast => we're fully connected now
OnConn();
}
// send it
SendDirect(C4NetIOPacket(&nPack, sizeof(nPack), false, addr));
}