124 | + if (ioctlsocket(m_socket, FIONBIO, &on) == SOCKET_ERROR) {
125 | + return false;
126 | + }
127 | +#else
128 | + const int flags{fcntl(m_socket, F_GETFL, 0)};
129 | + if (flags == SOCKET_ERROR) {
We were previously not checking for an error on this fcntl call. Is that really necessary or would the next fcntl call fail when being passed SOCKET_ERROR | O_NONBLOCK?
(Not against adding the error check, just wanted to note that i noticed the addition)
I do not know if the next fcntl() call would fail. The doc is a bit unclear what happens when passed unknown/invalid flags to fcntl(). Also, given that SOCKET_ERROR is -1 and O_NONBLOCK is 0x0004, then what is -1 | 0x0004? It is -1 actually, but is definitely something we don't want to do.