mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 14:38:18 +00:00
Added some assertions to the network
This commit is contained in:
parent
16f2899e3f
commit
e49e67e2f4
|
@ -138,6 +138,13 @@ int CNetClient::Recv(CNetChunk *pChunk, TOKEN *pResponseToken, int *pVersion)
|
|||
|
||||
int CNetClient::Send(CNetChunk *pChunk, TOKEN Token, int Version)
|
||||
{
|
||||
if(Version != NET_PACKETVERSION)
|
||||
{
|
||||
dbg_assert(m_Flags&NETFLAG_ALLOWOLDSTYLE && m_Flags&NETFLAG_ALLOWSTATELESS, "oldstyle packet sending not enabled");
|
||||
dbg_assert(pChunk->m_Flags&NETSENDFLAG_CONNLESS && pChunk->m_ClientID == -1, "only connless packets allowed for oldstyle network");
|
||||
dbg_assert(pChunk->m_Flags&NETSENDFLAG_STATELESS && Token == NET_TOKEN_NONE, "tokens can't be used in oldstyle packets");
|
||||
}
|
||||
|
||||
if(pChunk->m_Flags&NETSENDFLAG_CONNLESS)
|
||||
{
|
||||
if(pChunk->m_DataSize >= NET_MAX_PAYLOAD)
|
||||
|
|
|
@ -289,6 +289,13 @@ int CNetServer::Recv(CNetChunk *pChunk, TOKEN *pResponseToken, int *pVersion)
|
|||
|
||||
int CNetServer::Send(CNetChunk *pChunk, TOKEN Token, int Version)
|
||||
{
|
||||
if(Version != NET_PACKETVERSION)
|
||||
{
|
||||
dbg_assert(m_Flags&NETFLAG_ALLOWOLDSTYLE && m_Flags&NETFLAG_ALLOWSTATELESS, "oldstyle packet sending not enabled");
|
||||
dbg_assert(pChunk->m_Flags&NETSENDFLAG_CONNLESS && pChunk->m_ClientID == -1, "only connless packets allowed for oldstyle network");
|
||||
dbg_assert(pChunk->m_Flags&NETSENDFLAG_STATELESS && Token == NET_TOKEN_NONE, "tokens can't be used in oldstyle packets");
|
||||
}
|
||||
|
||||
if(pChunk->m_Flags&NETSENDFLAG_CONNLESS)
|
||||
{
|
||||
if(pChunk->m_DataSize >= NET_MAX_PAYLOAD)
|
||||
|
|
Loading…
Reference in a new issue