Browse Source

engine: initialize network buffers used on player connect and after

pull/2/head
Alibek Omarov 2 years ago
parent
commit
fccf044976
  1. 1
      engine/client/cl_main.c
  2. 1
      engine/common/net_chan.c
  3. 2
      engine/server/sv_client.c
  4. 1
      engine/server/sv_frame.c

1
engine/client/cl_main.c

@ -709,6 +709,7 @@ void CL_WritePacket( void )
CL_ComputePacketLoss (); CL_ComputePacketLoss ();
memset( data, 0, sizeof( data ));
MSG_Init( &buf, "ClientData", data, sizeof( data )); MSG_Init( &buf, "ClientData", data, sizeof( data ));
// Determine number of backup commands to send along // Determine number of backup commands to send along

1
engine/common/net_chan.c

@ -1589,6 +1589,7 @@ void Netchan_TransmitBits( netchan_t *chan, int length, byte *data )
} }
} }
memset( send_buf, 0, sizeof( send_buf ));
MSG_Init( &send, "NetSend", send_buf, sizeof( send_buf )); MSG_Init( &send, "NetSend", send_buf, sizeof( send_buf ));
// prepare the packet header // prepare the packet header

2
engine/server/sv_client.c

@ -1632,6 +1632,7 @@ static qboolean SV_New_f( sv_client_t *cl )
sizebuf_t msg; sizebuf_t msg;
int i; int i;
memset( msg_buf, 0, sizeof( msg_buf ));
MSG_Init( &msg, "New", msg_buf, sizeof( msg_buf )); MSG_Init( &msg, "New", msg_buf, sizeof( msg_buf ));
if( cl->state != cs_connected ) if( cl->state != cs_connected )
@ -1982,6 +1983,7 @@ static qboolean SV_SendRes_f( sv_client_t *cl )
if( cl->state != cs_connected ) if( cl->state != cs_connected )
return false; return false;
memset( buffer, 0, sizeof( buffer ));
MSG_Init( &msg, "SendResources", buffer, sizeof( buffer )); MSG_Init( &msg, "SendResources", buffer, sizeof( buffer ));
if( svs.maxclients > 1 && FBitSet( cl->flags, FCL_SEND_RESOURCES )) if( svs.maxclients > 1 && FBitSet( cl->flags, FCL_SEND_RESOURCES ))

1
engine/server/sv_frame.c

@ -711,6 +711,7 @@ void SV_SendClientDatagram( sv_client_t *cl )
byte msg_buf[MAX_DATAGRAM]; byte msg_buf[MAX_DATAGRAM];
sizebuf_t msg; sizebuf_t msg;
memset( msg_buf, 0, sizeof( msg_buf ));
MSG_Init( &msg, "Datagram", msg_buf, sizeof( msg_buf )); MSG_Init( &msg, "Datagram", msg_buf, sizeof( msg_buf ));
// always send servertime at new frame // always send servertime at new frame

Loading…
Cancel
Save