mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 22:48:18 +00:00
fixed connless packets sending
This commit is contained in:
parent
4e7137ad48
commit
ad070fe277
|
@ -105,8 +105,8 @@ void CNetBase::SendPacketConnless(NETSOCKET Socket, const NETADDR *pAddr, TOKEN
|
||||||
aBuffer[10] = (ResponseToken>>8)&0xff;
|
aBuffer[10] = (ResponseToken>>8)&0xff;
|
||||||
aBuffer[11] = (ResponseToken)&0xff;
|
aBuffer[11] = (ResponseToken)&0xff;
|
||||||
|
|
||||||
mem_copy(&aBuffer[15], pData, DataSize);
|
mem_copy(&aBuffer[NET_PACKETHEADERSIZE_CONNLESS], pData, DataSize);
|
||||||
net_udp_send(Socket, pAddr, aBuffer, 15+DataSize);
|
net_udp_send(Socket, pAddr, aBuffer, NET_PACKETHEADERSIZE_CONNLESS+DataSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CNetBase::SendPacket(NETSOCKET Socket, const NETADDR *pAddr, CNetPacketConstruct *pPacket)
|
void CNetBase::SendPacket(NETSOCKET Socket, const NETADDR *pAddr, CNetPacketConstruct *pPacket)
|
||||||
|
|
|
@ -155,11 +155,11 @@ int CNetServer::Recv(CNetChunk *pChunk, TOKEN *pResponseToken)
|
||||||
}
|
}
|
||||||
|
|
||||||
int Accept = m_TokenManager.ProcessMessage(&Addr, &m_RecvUnpacker.m_Data, true);
|
int Accept = m_TokenManager.ProcessMessage(&Addr, &m_RecvUnpacker.m_Data, true);
|
||||||
if(!Accept)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if(m_RecvUnpacker.m_Data.m_Flags&NET_PACKETFLAG_CONTROL)
|
if(m_RecvUnpacker.m_Data.m_Flags&NET_PACKETFLAG_CONTROL)
|
||||||
{
|
{
|
||||||
|
if(!Accept)
|
||||||
|
continue;
|
||||||
if(m_RecvUnpacker.m_Data.m_aChunkData[0] == NET_CTRLMSG_CONNECT)
|
if(m_RecvUnpacker.m_Data.m_aChunkData[0] == NET_CTRLMSG_CONNECT)
|
||||||
{
|
{
|
||||||
bool Found = false;
|
bool Found = false;
|
||||||
|
@ -229,6 +229,9 @@ int CNetServer::Recv(CNetChunk *pChunk, TOKEN *pResponseToken)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if(!Accept)
|
||||||
|
continue;
|
||||||
|
|
||||||
// TODO: check size here
|
// TODO: check size here
|
||||||
if(m_RecvUnpacker.m_Data.m_Flags&NET_PACKETFLAG_CONTROL && m_RecvUnpacker.m_Data.m_aChunkData[0] == NET_CTRLMSG_CONNECT)
|
if(m_RecvUnpacker.m_Data.m_Flags&NET_PACKETFLAG_CONTROL && m_RecvUnpacker.m_Data.m_aChunkData[0] == NET_CTRLMSG_CONNECT)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue