mirror of
https://github.com/libretro/RetroArch
synced 2025-03-28 19:20:35 +00:00
More careful disconnection.
This commit is contained in:
parent
c8bba9a981
commit
ab989d7f41
@ -298,21 +298,28 @@ static void hangup(netplay_t *netplay, struct netplay_connection *connection)
|
||||
netplay_deinit_socket_buffer(&connection->recv_packet_buffer);
|
||||
|
||||
if (!netplay->is_server)
|
||||
netplay->self_mode = NETPLAY_CONNECTION_NONE;
|
||||
|
||||
/* Remove this player */
|
||||
if (connection->mode == NETPLAY_CONNECTION_PLAYING)
|
||||
{
|
||||
netplay->connected_players &= ~(1<<connection->player);
|
||||
netplay->self_mode = NETPLAY_CONNECTION_NONE;
|
||||
netplay->connected_players = 0;
|
||||
|
||||
/* FIXME: Duplication */
|
||||
if (netplay->is_server)
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Remove this player */
|
||||
if (connection->mode == NETPLAY_CONNECTION_PLAYING)
|
||||
{
|
||||
uint32_t payload[2];
|
||||
payload[0] = htonl(netplay->read_frame_count[connection->player]);
|
||||
payload[1] = htonl(connection->player);
|
||||
netplay_send_raw_cmd_all(netplay, connection, NETPLAY_CMD_MODE, payload, sizeof(payload));
|
||||
netplay->connected_players &= ~(1<<connection->player);
|
||||
|
||||
/* FIXME: Duplication */
|
||||
if (netplay->is_server)
|
||||
{
|
||||
uint32_t payload[2];
|
||||
payload[0] = htonl(netplay->read_frame_count[connection->player]);
|
||||
payload[1] = htonl(connection->player);
|
||||
netplay_send_raw_cmd_all(netplay, connection, NETPLAY_CMD_MODE, payload, sizeof(payload));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -245,7 +245,8 @@ void netplay_sync_post_frame(netplay_t *netplay)
|
||||
netplay->self_frame_count++;
|
||||
|
||||
/* Only relevant if we're connected */
|
||||
if (netplay->is_server && !netplay->connected_players)
|
||||
if ((netplay->is_server && !netplay->connected_players) ||
|
||||
(netplay->self_mode < NETPLAY_CONNECTION_CONNECTED))
|
||||
{
|
||||
netplay->other_frame_count = netplay->self_frame_count;
|
||||
netplay->other_ptr = netplay->self_ptr;
|
||||
|
Loading…
x
Reference in New Issue
Block a user