mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-16 15:27:41 +00:00
Fix race condition in NAT traversal task.
This commit is contained in:
parent
ef5b8046f0
commit
972b41f803
@ -685,6 +685,7 @@ bool netplay_pre_frame(netplay_t *netplay)
|
||||
|
||||
/* NAT traversal if applicable */
|
||||
if (netplay->nat_traversal &&
|
||||
!netplay->nat_traversal_task_oustanding &&
|
||||
netplay->nat_traversal_state.request_outstanding &&
|
||||
!netplay->nat_traversal_state.have_inet4)
|
||||
{
|
||||
@ -1198,7 +1199,10 @@ bool netplay_driver_ctl(enum rarch_netplay_ctl_state state, void *data)
|
||||
ret = netplay_disconnect(netplay_data);
|
||||
goto done;
|
||||
case RARCH_NETPLAY_CTL_FINISHED_NAT_TRAVERSAL:
|
||||
netplay_data->nat_traversal_task_oustanding = false;
|
||||
#ifndef HAVE_SOCKET_LEGACY
|
||||
netplay_announce_nat_traversal(netplay_data);
|
||||
#endif
|
||||
goto done;
|
||||
default:
|
||||
case RARCH_NETPLAY_CTL_NONE:
|
||||
|
@ -1432,5 +1432,6 @@ void netplay_announce_nat_traversal(netplay_t *netplay)
|
||||
void netplay_init_nat_traversal(netplay_t *netplay)
|
||||
{
|
||||
memset(&netplay->nat_traversal_state, 0, sizeof(netplay->nat_traversal_state));
|
||||
netplay->nat_traversal_task_oustanding = true;
|
||||
task_push_netplay_nat_traversal(&netplay->nat_traversal_state, netplay->tcp_port);
|
||||
}
|
||||
|
@ -344,7 +344,7 @@ struct netplay
|
||||
uint16_t tcp_port;
|
||||
|
||||
/* NAT traversal info (if NAT traversal is used and serving) */
|
||||
bool nat_traversal;
|
||||
bool nat_traversal, nat_traversal_task_oustanding;
|
||||
struct natt_status nat_traversal_state;
|
||||
|
||||
struct delta_frame *buffer;
|
||||
|
Loading…
Reference in New Issue
Block a user