From a6be56dbdcbcd7b7a3ebf7dae7cd0537027486ea Mon Sep 17 00:00:00 2001 From: Magnus Auvinen Date: Thu, 16 Oct 2008 18:17:35 +0000 Subject: fixed crash bug when connecting/disconnecting --- src/engine/client/ec_client.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/engine/client/ec_client.c') diff --git a/src/engine/client/ec_client.c b/src/engine/client/ec_client.c index ef0a25af..3a9390fc 100644 --- a/src/engine/client/ec_client.c +++ b/src/engine/client/ec_client.c @@ -234,7 +234,7 @@ enum SNAPSTORAGE snapshot_storage; static SNAPSTORAGE_HOLDER *snapshots[NUM_SNAPSHOT_TYPES]; -static int recived_snapshots; +static int recived_snapshots = 0; static char snapshot_incomming_data[MAX_SNAPSHOT_SIZE]; static SNAPSTORAGE_HOLDER demorec_snapshotholders[NUM_SNAPSHOT_TYPES]; @@ -561,6 +561,11 @@ void client_disconnect_with_reason(const char *reason) /* clear the current server info */ mem_zero(¤t_server_info, sizeof(current_server_info)); + + /* clear snapshots */ + snapshots[SNAP_CURRENT] = 0; + snapshots[SNAP_PREV] = 0; + recived_snapshots = 0; } void client_disconnect() @@ -989,6 +994,10 @@ static void client_process_packet(NETCHUNK *packet) int complete_size = 0; const char *data = 0; + /* we are not allowed to process snapshot yet */ + if(client_state() < CLIENTSTATE_LOADING) + return; + if(msg == NETMSG_SNAP) { num_parts = msg_unpack_int(); -- cgit 1.4.1