mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-17 08:11:51 +00:00
rpcn: wait for signal before connect
This commit is contained in:
parent
df39bd39b0
commit
8a72bdb422
@ -168,18 +168,16 @@ namespace rpcn
|
||||
// By default is the object is alive we should be connected
|
||||
if (!connected)
|
||||
{
|
||||
bool result_connect;
|
||||
if (want_conn)
|
||||
{
|
||||
std::lock_guard lock(mutex_connected);
|
||||
result_connect = connect(g_cfg_rpcn.get_host());
|
||||
{
|
||||
std::lock_guard lock(mutex_connected);
|
||||
connect(g_cfg_rpcn.get_host());
|
||||
}
|
||||
sem_connected.release();
|
||||
}
|
||||
sem_connected.release();
|
||||
|
||||
if (!result_connect)
|
||||
{
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!authentified)
|
||||
@ -195,7 +193,6 @@ namespace rpcn
|
||||
|
||||
if (!result_login)
|
||||
{
|
||||
rpcn_log.notice("MT: login attempt failed");
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
@ -435,6 +432,7 @@ namespace rpcn
|
||||
if (res == 0)
|
||||
{
|
||||
// Remote closed connection
|
||||
rpcn_log.error("recv failed: connection reset by server");
|
||||
return recvn_result::recvn_noconn;
|
||||
}
|
||||
|
||||
@ -543,7 +541,6 @@ namespace rpcn
|
||||
|
||||
connected = false;
|
||||
authentified = false;
|
||||
want_auth = false;
|
||||
server_info_received = false;
|
||||
}
|
||||
|
||||
@ -1624,6 +1621,9 @@ namespace rpcn
|
||||
{
|
||||
return state;
|
||||
}
|
||||
|
||||
want_conn = true;
|
||||
sem_rpcn.release();
|
||||
}
|
||||
|
||||
sem_connected.acquire();
|
||||
|
@ -215,6 +215,7 @@ namespace rpcn
|
||||
|
||||
atomic_t<bool> connected = false;
|
||||
atomic_t<bool> authentified = false;
|
||||
atomic_t<bool> want_conn = false;
|
||||
atomic_t<bool> want_auth = false;
|
||||
std::binary_semaphore sem_connected, sem_authentified;
|
||||
std::mutex mutex_connected, mutex_authentified;
|
||||
|
Loading…
Reference in New Issue
Block a user