Skip to content

Commit

Permalink
socket.cpp: change error code for TCP disconnect
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
lstipakov committed Jun 16, 2022
1 parent 00b479d commit 63e7d51
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 63e7d51

Please sign in to comment.