[client/idd] input: complete network latency path

Isolate input sends from shared transport accounting and reserve
reliable capacity.

Prioritize QUIC execution and bound stale motion through the Windows
pipe and HID queues.
This commit is contained in:
Geoffrey McRae
2026-10-08 21:34:24 +11:00
parent 1af2f13440
commit b1dda92f09
9 changed files with 695 additions and 344 deletions

View File

@@ -38,7 +38,7 @@ const DWORD CPipeEndpoint::CLIENT_RETRY_MAX_MS = 2000;
const DWORD CPipeEndpoint::SERVER_RETRY_MS = 1000;
const DWORD CPipeEndpoint::AUTHENTICATION_TIMEOUT_MS = 2000;
const DWORD CPipeEndpoint::AUTHORIZATION_POLL_MS = 1000;
const DWORD CPipeEndpoint::WRITE_TIMEOUT_MS = 250;
const DWORD CPipeEndpoint::DEFAULT_WRITE_TIMEOUT_MS = 250;
bool CPipeEndpoint::IsDisconnectedError(DWORD error)
{
@@ -159,7 +159,7 @@ CPipeEndpoint::PipeIoResult CPipeEndpoint::WriteMessage(
m_writeEvent,
&overlapped,
&bytesWritten,
WRITE_TIMEOUT_MS);
m_writeTimeoutMs);
else if (IsDisconnectedError(error))
result = PipeIoResult::Disconnected;
else if (error == ERROR_OPERATION_ABORTED &&
@@ -199,7 +199,8 @@ bool CPipeEndpoint::Start(
const SECURITY_ATTRIBUTES * serverSecurity,
DWORD serverOpenMode,
DWORD serverPipeMode,
ThreadScheduling threadScheduling)
ThreadScheduling threadScheduling,
DWORD writeTimeoutMs)
{
Stop();
@@ -215,6 +216,7 @@ bool CPipeEndpoint::Start(
SECURITY_ATTRIBUTES {};
m_serverOpenMode = serverOpenMode;
m_serverPipeMode = serverPipeMode;
m_writeTimeoutMs = writeTimeoutMs;
m_stopEvent = CreateEventW(nullptr, TRUE, FALSE, nullptr);
if (!m_stopEvent)
{

View File

@@ -74,6 +74,8 @@ public:
class CPipeEndpoint
{
public:
static const DWORD DEFAULT_WRITE_TIMEOUT_MS;
enum class Mode
{
Server,
@@ -99,7 +101,8 @@ public:
_In_opt_ const SECURITY_ATTRIBUTES * serverSecurity = nullptr,
_In_ DWORD serverOpenMode = 0,
_In_ DWORD serverPipeMode = 0,
_In_ ThreadScheduling threadScheduling = ThreadScheduling::Normal);
_In_ ThreadScheduling threadScheduling = ThreadScheduling::Normal,
_In_ DWORD writeTimeoutMs = DEFAULT_WRITE_TIMEOUT_MS);
void Stop();
void DisconnectClient();
@@ -132,7 +135,6 @@ private:
static const DWORD SERVER_RETRY_MS;
static const DWORD AUTHENTICATION_TIMEOUT_MS;
static const DWORD AUTHORIZATION_POLL_MS;
static const DWORD WRITE_TIMEOUT_MS;
static bool IsDisconnectedError(_In_ DWORD error);
PipeIoResult WaitForOverlapped(
@@ -173,6 +175,7 @@ private:
bool m_hasServerSecurity = false;
DWORD m_serverOpenMode = 0;
DWORD m_serverPipeMode = 0;
DWORD m_writeTimeoutMs = DEFAULT_WRITE_TIMEOUT_MS;
std::atomic<bool> m_running { false };
std::atomic<bool> m_connected { false };