diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-05-29 00:18:10 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-05-29 00:18:10 +0000 |
commit | 337edbb62cad368b9854e15d102cbce3586adb75 (patch) | |
tree | adfdae9cd7849572f3a45efca5fd29791161e2e6 | |
parent | afd91fdfaa77513cae5e3a5785481b391ac5564d (diff) |
Added extra error checking to detect dead sockets
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1544 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/servers.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/servers.cpp b/src/servers.cpp index 5fa506ba7..d36404fa6 100644 --- a/src/servers.cpp +++ b/src/servers.cpp @@ -462,6 +462,21 @@ bool serverrec::RecvPacket(std::deque<std::string> &messages, char* recvhost,std rcvsize = recv(this->connectors[i].GetDescriptor(),data,65000,0); data[rcvsize] = '\0'; + if (rcvsize == 0) + { + log(DEBUG,"recv() failed for serverrec::RecvPacket(): EOF"); + log(DEBUG,"Disabling connector: %s",this->connectors[i].GetServerName().c_str()); + this->connectors[i].CloseConnection(); + this->connectors[i].SetState(STATE_DISCONNECTED); + if (!IsRoutable(this->connectors[i].GetServerName())) + { + WriteOpers("*** Server %s is no longer routable, disconnecting (EOF)",this->connectors[i].GetServerName().c_str()); + snprintf(buffer,MAXBUF,"& %s",this->connectors[i].GetServerName().c_str()); + NetSendToAllExcept(this->connectors[i].GetServerName().c_str(),buffer); + DoSplit(this->connectors[i].GetServerName().c_str()); + } + has_been_netsplit = true; + } if (rcvsize == -1) { if (errno != EAGAIN) |