mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
fixed crash when joining a server when connected to one already
This commit is contained in:
parent
d84e653f6d
commit
e06dd7d5d7
|
@ -396,6 +396,8 @@ void client_connect(const char *server_address_str)
|
||||||
const char *port_str = 0;
|
const char *port_str = 0;
|
||||||
int k;
|
int k;
|
||||||
int port = 8303;
|
int port = 8303;
|
||||||
|
|
||||||
|
client_disconnect();
|
||||||
|
|
||||||
dbg_msg("client", "connecting to '%s'", server_address_str);
|
dbg_msg("client", "connecting to '%s'", server_address_str);
|
||||||
|
|
||||||
|
@ -435,9 +437,7 @@ void client_disconnect_with_reason(const char *reason)
|
||||||
|
|
||||||
void client_disconnect()
|
void client_disconnect()
|
||||||
{
|
{
|
||||||
netclient_disconnect(net, 0);
|
client_disconnect_with_reason(0);
|
||||||
client_set_state(CLIENTSTATE_OFFLINE);
|
|
||||||
map_unload();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int client_load_data()
|
static int client_load_data()
|
||||||
|
|
|
@ -208,6 +208,7 @@ static void conn_reset(NETCONNECTION *conn)
|
||||||
conn->last_recv_time = 0;
|
conn->last_recv_time = 0;
|
||||||
conn->last_update_time = 0;
|
conn->last_update_time = 0;
|
||||||
conn->token = -1;
|
conn->token = -1;
|
||||||
|
mem_zero(&conn->peeraddr, sizeof(conn->peeraddr));
|
||||||
|
|
||||||
rb_clear(&conn->buffer);
|
rb_clear(&conn->buffer);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue