mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-01 03:32:07 +00:00
Fix recvn high cpu usage
This commit is contained in:
parent
bcce3acd5f
commit
192f4825a2
@ -496,14 +496,13 @@ namespace rpcn
|
||||
{
|
||||
if (wolfSSL_want_read(read_wssl))
|
||||
{
|
||||
// If we received partially what we want try to wait longer
|
||||
if (n_recv == 0)
|
||||
return recvn_result::recvn_nodata;
|
||||
|
||||
pollfd poll_fd{};
|
||||
|
||||
while ((poll_fd.revents & POLLIN) != POLLIN && (poll_fd.revents & POLLRDNORM) != POLLRDNORM)
|
||||
{
|
||||
if (!connected)
|
||||
return recvn_result::recvn_noconn;
|
||||
|
||||
if (terminate)
|
||||
return recvn_result::recvn_terminate;
|
||||
|
||||
@ -523,8 +522,12 @@ namespace rpcn
|
||||
}
|
||||
|
||||
num_timeouts++;
|
||||
|
||||
if (num_timeouts > (RPCN_TIMEOUT / RPCN_TIMEOUT_INTERVAL))
|
||||
{
|
||||
if (n_recv == 0)
|
||||
return recvn_result::recvn_nodata;
|
||||
|
||||
rpcn_log.error("recvn timeout with %d bytes received", n_recv);
|
||||
return recvn_result::recvn_timeout;
|
||||
}
|
||||
@ -545,6 +548,12 @@ namespace rpcn
|
||||
|
||||
res = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Reset timeout each time something is received
|
||||
num_timeouts = 0;
|
||||
}
|
||||
|
||||
n_recv += res;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user