From 5b08c0883c83c95ceca07e590620fe254b17f6ab Mon Sep 17 00:00:00 2001 From: brain Date: Tue, 24 May 2005 01:49:07 +0000 Subject: Added ping checks for server links (experimental) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1481 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/servers.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/servers.cpp') diff --git a/src/servers.cpp b/src/servers.cpp index 15929345f..38f9cfb5f 100644 --- a/src/servers.cpp +++ b/src/servers.cpp @@ -250,6 +250,15 @@ void serverrec::FlushWriteBuffers() { for (int i = 0; i < this->connectors.size(); i++) { + if (this->connectors[i].GetState() != STATE_DISCONNECTED) + { + if (!this->connectors[i].CheckPing()) + { + WriteOpers("*** Lost single connection to %s: Ping timeout",this->connectors[i].GetServerName().c_str()); + this->connectors[i].CloseConnection(); + this->connectors[i].SetState(STATE_DISCONNECTED); + } + } if (this->connectors[i].HasBufferedOutput()) { if (!this->connectors[i].FlushWriteBuf()) @@ -400,6 +409,7 @@ bool serverrec::RecvPacket(std::deque &messages, char* recvhost,std } if (this->connectors[i].BufferIsComplete()) { + this->connectors[i].ResetPing(); while (this->connectors[i].BufferIsComplete()) { std::string text = this->connectors[i].GetBuffer(); -- cgit v1.2.3