summaryrefslogtreecommitdiff
path: root/node/TcpSocket.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@zerotier.com>2014-03-28 12:26:33 -0700
committerAdam Ierymenko <adam.ierymenko@zerotier.com>2014-03-28 12:26:33 -0700
commite8b613e625d18a03d14073e4634cdfb64e120d38 (patch)
tree5c0192b890e59a8c26ac145984507130b7dfb76d /node/TcpSocket.cpp
parent9c68a343f600f92019561662d41a5261728bc698 (diff)
downloadinfinitytier-e8b613e625d18a03d14073e4634cdfb64e120d38.tar.gz
infinitytier-e8b613e625d18a03d14073e4634cdfb64e120d38.zip
TCP connections work on Windows now.
Diffstat (limited to 'node/TcpSocket.cpp')
-rw-r--r--node/TcpSocket.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/node/TcpSocket.cpp b/node/TcpSocket.cpp
index 5d475c93..fd8e9a94 100644
--- a/node/TcpSocket.cpp
+++ b/node/TcpSocket.cpp
@@ -164,6 +164,16 @@ bool TcpSocket::notifyAvailableForWrite(const SharedPtr<Socket> &self,SocketMana
if (_outptr) {
int n = (int)::send(_sock,(const char *)_outbuf,_outptr,0);
+#ifdef __WINDOWS__
+ if (n == SOCKET_ERROR) {
+ switch(WSAGetLastError()) {
+ case WSAEINTR:
+ case WSAEWOULDBLOCK:
+ break;
+ default:
+ return false;
+ }
+#else
if (n <= 0) {
switch(errno) {
#ifdef EAGAIN
@@ -179,6 +189,7 @@ bool TcpSocket::notifyAvailableForWrite(const SharedPtr<Socket> &self,SocketMana
default:
return false;
}
+#endif
} else memmove(_outbuf,_outbuf + (unsigned int)n,_outptr -= (unsigned int)n);
}