summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorSepalani <sepalani@hotmail.fr>2024-02-03 12:19:29 +0400
committerSepalani <sepalani@hotmail.fr>2024-04-06 21:43:48 +0400
commit6e2a081cb9a10cc757da17c7cf3eba8ecd7837b5 (patch)
treeb64767f4eb3a25558fdb19a19f33fcde3300a57a /Source/Core
parent9e0bf2932923f59357786f1d442c05aaeaaa7059 (diff)
BBA/HLE: Loop over network_ref once
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/HW/EXI/BBA/BuiltIn.cpp49
1 files changed, 24 insertions, 25 deletions
diff --git a/Source/Core/Core/HW/EXI/BBA/BuiltIn.cpp b/Source/Core/Core/HW/EXI/BBA/BuiltIn.cpp
index ba5da0248e..8e44804d19 100644
--- a/Source/Core/Core/HW/EXI/BBA/BuiltIn.cpp
+++ b/Source/Core/Core/HW/EXI/BBA/BuiltIn.cpp
@@ -658,39 +658,38 @@ void CEXIETHERNET::BuiltInBBAInterface::ReadThreadHandler(CEXIETHERNET::BuiltInB
self->m_queue_read++;
self->m_queue_read &= 15;
}
- else
+
+ // Check network stack references
+ for (auto& net_ref : self->network_ref)
{
- // test connections data
- for (auto& net_ref : self->network_ref)
+ if (net_ref.ip == 0)
+ continue;
+
+ // Check for sleeping TCP data
+ if (net_ref.type == IPPROTO_TCP)
{
- if (net_ref.ip == 0)
- continue;
- const auto socket_data = self->TryGetDataFromSocket(&net_ref);
- if (socket_data.has_value())
+ for (auto& tcp_buf : net_ref.tcp_buffers)
{
- datasize = socket_data->size();
- std::memcpy(self->m_eth_ref->mRecvBuffer.get(), socket_data->data(), datasize);
- break;
+ 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);
+ }
}
}
- }
- // test and add any sleeping tcp data
- for (auto& net_ref : self->network_ref)
- {
- if (net_ref.ip == 0 || net_ref.type != IPPROTO_TCP)
+ // Check for connection data
+ if (datasize != 0)
continue;
- for (auto& tcp_buf : net_ref.tcp_buffers)
+ const auto socket_data = self->TryGetDataFromSocket(&net_ref);
+ if (socket_data.has_value())
{
- if (!tcp_buf.used || (GetTickCountStd() - tcp_buf.tick) <= 1000)
- continue;
-
- tcp_buf.tick = GetTickCountStd();
- // timmed out packet, resend
- if (((self->m_queue_write + 1) & 15) != self->m_queue_read)
- {
- self->WriteToQueue(tcp_buf.data);
- }
+ datasize = socket_data->size();
+ std::memcpy(self->m_eth_ref->mRecvBuffer.get(), socket_data->data(), datasize);
}
}