From 63e7d511aef2dbcd58df2fc9f3199adea0f8090f Mon Sep 17 00:00:00 2001 From: Lev Stipakov Date: Thu, 16 Jun 2022 11:45:47 +0300 Subject: [PATCH] socket.cpp: change error code for TCP disconnect The NTSTATUS code used for TCP disconnect (STATUS_REMOTE_DISCONNECT) is translated into Win32 error ERROR_NETNAME_DELETED - the same code to which keepalive timeout (STATUS_CONNECTION_DISCONNECTED) is translated. To differentiate between those, use STATUS_CONNECTON_ABORTED, which is translated into Win32 code ERROR_CONNECTION_ABORTED. Signed-off-by: Lev Stipakov --- socket.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/socket.cpp b/socket.cpp index a9aab12..7be9d16 100644 --- a/socket.cpp +++ b/socket.cpp @@ -423,7 +423,7 @@ OvpnSocketTcpDisconnectEvent(_In_opt_ PVOID socketContext, _In_ ULONG flags) NTSTATUS status = WdfIoQueueRetrieveNextRequest(device->PendingReadsQueue, &request); if (NT_SUCCESS(status)) { ULONG_PTR bytesCopied = 0; - WdfRequestCompleteWithInformation(request, STATUS_REMOTE_DISCONNECT, bytesCopied); + WdfRequestCompleteWithInformation(request, STATUS_CONNECTION_ABORTED, bytesCopied); } else { LOG_WARN("No pending read request, cannot inform userspace");