summaryrefslogtreecommitdiff
path: root/node/TcpSocket.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2014-03-31 22:23:55 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2014-03-31 22:23:55 -0700
commitf13493edb2aae228ddbe70cc2f0609c541faf2d7 (patch)
treecb1a6845ec82e2ea361ce15e88440a249992091c /node/TcpSocket.cpp
parent595b386afcd4e4eca0cf379cd14689c1db8ee647 (diff)
downloadinfinitytier-f13493edb2aae228ddbe70cc2f0609c541faf2d7.tar.gz
infinitytier-f13493edb2aae228ddbe70cc2f0609c541faf2d7.zip
Oops... turns out we need to differentiate incoming from outgoing TCP and indeed learn incoming TCP paths. Otherwise the recipient of a TCP connection does not know to reply via TCP! Heh.
Diffstat (limited to 'node/TcpSocket.cpp')
-rw-r--r--node/TcpSocket.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/node/TcpSocket.cpp b/node/TcpSocket.cpp
index 7dbcc4e1..b21cbd5e 100644
--- a/node/TcpSocket.cpp
+++ b/node/TcpSocket.cpp
@@ -72,7 +72,6 @@ bool TcpSocket::send(const InetAddress &to,const void *msg,unsigned int msglen)
return true; // sanity check
Mutex::Lock _l(_writeLock);
-
bool writeInProgress = ((_outptr != 0)||(_connecting));
// Ensure that _outbuf is large enough
@@ -144,9 +143,10 @@ bool TcpSocket::notifyAvailableForRead(const SharedPtr<Socket> &self,SocketManag
if ((pl)&&(p >= pl)) {
Buffer<ZT_SOCKET_MAX_MESSAGE_LEN> data(_inbuf + 5,pl - 5);
- sm->handleReceivedPacket(self,_remote,data);
- memmove(_inbuf,_inbuf + pl,p - pl);
- p -= pl;
+ memmove(_inbuf,_inbuf + pl,p -= pl);
+ try {
+ sm->handleReceivedPacket(self,_remote,data);
+ } catch ( ... ) {} // handlers should not throw
pl = 0;
}
}