Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CompletionPort::get incorrectly handles failure #25

Open
kryptan opened this issue Nov 19, 2019 · 0 comments
Open

CompletionPort::get incorrectly handles failure #25

kryptan opened this issue Nov 19, 2019 · 0 comments

Comments

@kryptan
Copy link

kryptan commented Nov 19, 2019

If GetQueuedCompletionStatus returns FALSE then CompletionPort::get returns io::Error. However, GetQueuedCompletionStatus can return FALSE in two cases:

  • GetQueuedCompletionStatus has itself failed (e.g. due to a timeout).
  • Completion status was successfully dequeued for a failed operation. In this case there are useful values returned in argument pointers.

From the MSDN:

Upon failure (the return value is FALSE), those same parameters can contain particular value combinations as follows:

  • If *lpOverlapped is NULL, the function did not dequeue a completion packet from the completion port. In this case, the function does not store information in the variables pointed to by the lpNumberOfBytes and lpCompletionKey parameters, and their values are indeterminate.
  • If *lpOverlapped is not NULL and the function dequeues a completion packet for a failed I/O operation from the completion port, the function stores information about the failed operation in the variables pointed to by lpNumberOfBytes, lpCompletionKey, and lpOverlapped. To get extended error information, call GetLastError.

Current implementation doesn't handle second case. If operation fails then it simply returns io::Error without any indication of which operation has actually failed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant