mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[ntcore] Fix EALREADY errors by tracking read state (#7202)
This commit is contained in:
@@ -59,8 +59,18 @@ class WebSocketConnection final
|
||||
return m_ws.GetLastReceivedTime();
|
||||
}
|
||||
|
||||
void StopRead() final { m_ws.GetStream().StopRead(); }
|
||||
void StartRead() final { m_ws.GetStream().StartRead(); }
|
||||
void StopRead() final {
|
||||
if (m_readActive) {
|
||||
m_ws.GetStream().StopRead();
|
||||
m_readActive = false;
|
||||
}
|
||||
}
|
||||
void StartRead() final {
|
||||
if (!m_readActive) {
|
||||
m_ws.GetStream().StartRead();
|
||||
m_readActive = true;
|
||||
}
|
||||
}
|
||||
|
||||
void Disconnect(std::string_view reason) final;
|
||||
|
||||
@@ -80,6 +90,7 @@ class WebSocketConnection final
|
||||
|
||||
wpi::WebSocket& m_ws;
|
||||
wpi::Logger& m_logger;
|
||||
bool m_readActive = true;
|
||||
|
||||
class Stream;
|
||||
|
||||
|
||||
@@ -41,8 +41,18 @@ class UvStreamConnection3 final
|
||||
|
||||
uint64_t GetLastFlushTime() const final { return m_lastFlushTime; }
|
||||
|
||||
void StopRead() final { m_stream.StopRead(); }
|
||||
void StartRead() final { m_stream.StartRead(); }
|
||||
void StopRead() final {
|
||||
if (m_readActive) {
|
||||
m_stream.StopRead();
|
||||
m_readActive = false;
|
||||
}
|
||||
}
|
||||
void StartRead() final {
|
||||
if (!m_readActive) {
|
||||
m_stream.StartRead();
|
||||
m_readActive = true;
|
||||
}
|
||||
}
|
||||
|
||||
void Disconnect(std::string_view reason) final;
|
||||
|
||||
@@ -62,6 +72,7 @@ class UvStreamConnection3 final
|
||||
std::string m_reason;
|
||||
uint64_t m_lastFlushTime = 0;
|
||||
int m_sendsActive = 0;
|
||||
bool m_readActive = true;
|
||||
};
|
||||
|
||||
} // namespace nt::net3
|
||||
|
||||
Reference in New Issue
Block a user