Closed borrrden closed 5 years ago
Yes. Cool. Better to consider some loosely-related fixes separately than in one big PR.
OMG, is the Windows SOCKET
type unsigned?!?!
If so, can the accept() call really be the only place in the code that this is a problem?
Good thinking, there are probably more. I'll update the PR to fix the rest :p
I counted roughly a dozen places that check_ret
or check_ret_bool
was used (all I could find). There was only one other function that returns SOCKET
on Windows so I corrected it.
Cool. I'll merge this shortly and take a look. I also grep'ed for any additional "< 0" comparisons, but I think we're close. I may have been aware of this when I first wrote the library, but forgotten it since then! There are a lot of explicit comparisons to the invalid socket constant, which I don't normally do in Linux programming. I used Windows a lot back then, but not really at all any more.
I made one minor change... As check_socket()
and check_socket_bool()
are specifically meant to take sockets, I changed them from template functions to regular inline functions taking a socket_t
value.
Pushed into develop
.
This is also included in #17 but I figured I'd make it standalone as well since it is outside the context of TLS support.