diff --git a/src/engine/client/ec_client.c b/src/engine/client/ec_client.c index 9773d364a..1b9b01201 100644 --- a/src/engine/client/ec_client.c +++ b/src/engine/client/ec_client.c @@ -396,6 +396,8 @@ void client_connect(const char *server_address_str) const char *port_str = 0; int k; int port = 8303; + + client_disconnect(); dbg_msg("client", "connecting to '%s'", server_address_str); @@ -435,9 +437,7 @@ void client_disconnect_with_reason(const char *reason) void client_disconnect() { - netclient_disconnect(net, 0); - client_set_state(CLIENTSTATE_OFFLINE); - map_unload(); + client_disconnect_with_reason(0); } static int client_load_data() diff --git a/src/engine/e_network.c b/src/engine/e_network.c index b0c9bfc8f..689e45ab5 100644 --- a/src/engine/e_network.c +++ b/src/engine/e_network.c @@ -208,6 +208,7 @@ static void conn_reset(NETCONNECTION *conn) conn->last_recv_time = 0; conn->last_update_time = 0; conn->token = -1; + mem_zero(&conn->peeraddr, sizeof(conn->peeraddr)); rb_clear(&conn->buffer); }