Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Be more flexible when detecting Windows:
We need to know if we are using windows to decide which code to use to set a socket to non-blocking behaviour in __fh_nonblocking (used by __try_read_sock). We had reports of blocking on Windows (see #20 and #21), and the solution given on #21 is to use replace read() with sysread() in __try_read_sock(). The fact that this works is a point in its favor, but after that call, we do a ungetc() to put back what we've read. According to Perl documentation, we should not mix sysread (unbuffered I/O) with read/ungetc (buffered I/O) so I don't really like the sysread solution. So I'll try this first instead: the logic behind this commit is that for some reason, the socket is not in non-blocking mode when it reaches the read() call, and it blocks. This should catch more cases of mswin32 usage, and it might fix the issue for good. If it does not, I'll quickly relase a sysread-based release but that uses sysread only on Windows (I've tested sysread on UNIX systems and it would break as expected). Signed-off-by: Pedro Melo <melo@simplicidade.org>
- Loading branch information