libzmq
libzmq copied to clipboard
Problem: zmq_abort() may be called on Windows if polling fails
Summary
Fixes occasional abort()s on Windows platform caused by unhandled errors returned by WSAPoll(), causing occasional crashes.
Problem
Error handling for the poll() function is left to the caller, that should remember to use WSAGetLastError() instead of using errno to find out the error reason. This requires #ifdef ZMQ_HAVE_WINDOWS ... #endif and Windows-specific code to be done for each poll() invocation.
Solution
On Windows platform, implement custom WSA error to errno translation in the poll() function itself. The goal is to make Windows-specific poll() to appear more Unixy to the callers.
Changes
- Windows-specific
poll()function implementation inwindows.hpp
Platforms affected
- Windows
Checklist
- [x] Code compiles correctly
- [x] No new compiler warnings
- [x] No breaking API changes
- [x] Comments added where needed
- [x] Change is scoped to Windows-specific logic