#elif defined(_MSC_VER)
#include <winsock.h>
#endif
-#include <assert.h>
/* by default, windows handles only 64 fd's */
#if defined(MS_WINDOWS) && !defined(FD_SETSIZE)
for (idx = 0; idx < nfds; ++idx) {
ufds[idx].revents = 0;
fd = ufds[idx].fd;
- assert (fd >= 0);
+ tor_assert(fd >= 0);
if (fd > maxfd) {
maxfd = fd;
#ifdef MS_WINDOWS
/* On Windows, WSAEWOULDBLOCK is not always correct: when you see it,
* you need to ask the socket for its actual errno. Also, you need to
- * get your errors from WSAGetLastError, not errno.
+ * get your errors from WSAGetLastError, not errno. (If you supply a
+ * socket of -1, we check WSAGetLastError, but don't correct
+ * WSAEWOULDBLOCKs.)
*/
#ifdef MS_WINDOWS
int tor_socket_errno(int sock)
#define ERRNO_IS_EINPROGRESS(e) ((e) == EINPROGRESS)
#define ERRNO_IS_CONN_EINPROGRESS(e) ((e) == EINPROGRESS)
#define tor_socket_errno(sock) (errno)
-#define tor_socket_strerror(e) strerror(e)
+#define tor_socket_strerror(e) strerror(e)
#endif
#endif