mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-10 08:09:26 +01:00
BBA/HLE: Loop over network_ref once
This commit is contained in:
parent
9e0bf29329
commit
6e2a081cb9
@ -658,40 +658,39 @@ void CEXIETHERNET::BuiltInBBAInterface::ReadThreadHandler(CEXIETHERNET::BuiltInB
|
|||||||
self->m_queue_read++;
|
self->m_queue_read++;
|
||||||
self->m_queue_read &= 15;
|
self->m_queue_read &= 15;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
// test connections data
|
|
||||||
for (auto& net_ref : self->network_ref)
|
|
||||||
{
|
|
||||||
if (net_ref.ip == 0)
|
|
||||||
continue;
|
|
||||||
const auto socket_data = self->TryGetDataFromSocket(&net_ref);
|
|
||||||
if (socket_data.has_value())
|
|
||||||
{
|
|
||||||
datasize = socket_data->size();
|
|
||||||
std::memcpy(self->m_eth_ref->mRecvBuffer.get(), socket_data->data(), datasize);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// test and add any sleeping tcp data
|
// Check network stack references
|
||||||
for (auto& net_ref : self->network_ref)
|
for (auto& net_ref : self->network_ref)
|
||||||
{
|
{
|
||||||
if (net_ref.ip == 0 || net_ref.type != IPPROTO_TCP)
|
if (net_ref.ip == 0)
|
||||||
continue;
|
continue;
|
||||||
for (auto& tcp_buf : net_ref.tcp_buffers)
|
|
||||||
{
|
|
||||||
if (!tcp_buf.used || (GetTickCountStd() - tcp_buf.tick) <= 1000)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
tcp_buf.tick = GetTickCountStd();
|
// Check for sleeping TCP data
|
||||||
// timmed out packet, resend
|
if (net_ref.type == IPPROTO_TCP)
|
||||||
if (((self->m_queue_write + 1) & 15) != self->m_queue_read)
|
{
|
||||||
|
for (auto& tcp_buf : net_ref.tcp_buffers)
|
||||||
{
|
{
|
||||||
self->WriteToQueue(tcp_buf.data);
|
if (!tcp_buf.used || (GetTickCountStd() - tcp_buf.tick) <= 1000)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
tcp_buf.tick = GetTickCountStd();
|
||||||
|
// Timed out packet, resend
|
||||||
|
if (((self->m_queue_write + 1) & 15) != self->m_queue_read)
|
||||||
|
{
|
||||||
|
self->WriteToQueue(tcp_buf.data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check for connection data
|
||||||
|
if (datasize != 0)
|
||||||
|
continue;
|
||||||
|
const auto socket_data = self->TryGetDataFromSocket(&net_ref);
|
||||||
|
if (socket_data.has_value())
|
||||||
|
{
|
||||||
|
datasize = socket_data->size();
|
||||||
|
std::memcpy(self->m_eth_ref->mRecvBuffer.get(), socket_data->data(), datasize);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for new UPnP client
|
// Check for new UPnP client
|
||||||
|
Loading…
x
Reference in New Issue
Block a user