Fix error propagation from WinSock functions. Fix cleanup of sockets. Allow the handshake to be interrupted.

This commit is contained in:
Cameron Gutman
2014-01-20 19:26:33 -05:00
parent d6c77b0323
commit 2f83dba24c
7 changed files with 48 additions and 22 deletions
+2
View File
@@ -4,6 +4,7 @@
#ifdef _WIN32
#include <Windows.h>
#define SetLastSocketError(x) WSASetLastError(x)
#define LastSocketError() WSAGetLastError()
#else
#include <sys/types.h>
@@ -13,6 +14,7 @@
#include <errno.h>
#define SOCKET int
#define LastSocketError() errno
#define SetLastSocketError(x) errno = x
#define INVALID_SOCKET -1
#define SOCKET_ERROR -1
#define closesocket(x) close(x)