mirror of
https://github.com/janet-lang/janet
synced 2025-06-25 22:52:51 +00:00
Merge pull request #908 from ishehadeh/master
Windows: Fix `ev/read` hanging when called on stream from `os/open`
This commit is contained in:
commit
ab53208f47
@ -2219,6 +2219,10 @@ JanetAsyncStatus ev_machine_read(JanetListenerState *s, JanetAsyncEvent event) {
|
|||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
// Some handles (not all) read from the offset in lopOverlapped
|
||||||
|
// if its not set before calling `ReadFile` these streams will always read from offset 0
|
||||||
|
state->overlapped.Offset = (DWORD) state->bytes_read;
|
||||||
|
|
||||||
status = ReadFile(s->stream->handle, state->chunk_buf, chunk_size, NULL, &state->overlapped);
|
status = ReadFile(s->stream->handle, state->chunk_buf, chunk_size, NULL, &state->overlapped);
|
||||||
if (!status && (ERROR_IO_PENDING != WSAGetLastError())) {
|
if (!status && (ERROR_IO_PENDING != WSAGetLastError())) {
|
||||||
if (WSAGetLastError() == ERROR_BROKEN_PIPE) {
|
if (WSAGetLastError() == ERROR_BROKEN_PIPE) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user