prevent backpressure when m_read_enabled is not set

This commit is contained in:
Martin Michelsen 2024-03-17 18:32:10 -07:00
parent 3e9ac1aaf3
commit f7a0147176
2 changed files with 10 additions and 3 deletions

View File

@ -266,7 +266,7 @@ void TAPServerConnection::ReadThreadHandler()
if (select_res < 0) if (select_res < 0)
{ {
ERROR_LOG_FMT(SP1, "Can\'t poll tapserver fd: {}", Common::StrNetworkError()); ERROR_LOG_FMT(SP1, "Can\'t poll tapserver fd: {}", Common::StrNetworkError());
break; continue;
} }
if (select_res == 0) if (select_res == 0)
continue; continue;
@ -295,7 +295,10 @@ void TAPServerConnection::ReadThreadHandler()
} }
else else
{ {
read_state = ReadState::DATA; // If read is disabled, we still need to actually read the frame in
// order to avoid applying backpressure on the remote end, but we
// should drop the frame instead of forwarding it to the client.
read_state = m_read_enabled.IsSet() ? ReadState::DATA : ReadState::SKIP;
} }
} }
else else
@ -326,7 +329,7 @@ void TAPServerConnection::ReadThreadHandler()
} }
else else
{ {
read_state = ReadState::DATA; read_state = m_read_enabled.IsSet() ? ReadState::DATA : ReadState::SKIP;
} }
break; break;
} }

View File

@ -44,6 +44,7 @@ CEXIModem::CEXIModem(Core::System& system, ModemDeviceType type) : IEXIDevice(sy
CEXIModem::~CEXIModem() CEXIModem::~CEXIModem()
{ {
m_network_interface->RecvStop();
m_network_interface->Deactivate(); m_network_interface->Deactivate();
} }
@ -69,6 +70,7 @@ void CEXIModem::ImmWrite(u32 data, u32 size)
m_transfer_descriptor = data; m_transfer_descriptor = data;
if (m_transfer_descriptor == 0x00008000) if (m_transfer_descriptor == 0x00008000)
{ // Reset { // Reset
m_network_interface->RecvStop();
m_network_interface->Deactivate(); m_network_interface->Deactivate();
m_transfer_descriptor = INVALID_TRANSFER_DESCRIPTOR; m_transfer_descriptor = INVALID_TRANSFER_DESCRIPTOR;
} }
@ -366,6 +368,7 @@ void CEXIModem::RunAllPendingATCommands()
if (command.substr(0, 3) == "ATZ" || command == "ATH0") if (command.substr(0, 3) == "ATZ" || command == "ATH0")
{ {
// Reset (ATZ) or hang up (ATH0) // Reset (ATZ) or hang up (ATH0)
m_network_interface->RecvStop();
m_network_interface->Deactivate(); m_network_interface->Deactivate();
AddATReply("OK\r"); AddATReply("OK\r");
} }
@ -374,6 +377,7 @@ void CEXIModem::RunAllPendingATCommands()
// Dial // Dial
if (m_network_interface->Activate()) if (m_network_interface->Activate())
{ {
m_network_interface->RecvStart();
AddATReply("OK\rCONNECT 115200\r"); // Maximum baud rate AddATReply("OK\rCONNECT 115200\r"); // Maximum baud rate
} }
else else