diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-05-24 04:05:14 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-05-24 04:05:14 +0000 |
commit | 88a4177e285d65affeb2c2b97e308449a2c0cd4c (patch) | |
tree | 42361db8c02d39f2d9d495da590a28fd00c4e03a /src/servers.cpp | |
parent | 66f0cd6469d2643858c2fcd14726d362696bd68d (diff) |
Nonblocking connect() for outbound server links (why was this blocking anyway)
Changed /map to show authenticating servers with a * similar to hybrid
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1485 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/servers.cpp')
-rw-r--r-- | src/servers.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/servers.cpp b/src/servers.cpp index 38f9cfb5f..7ae90e41b 100644 --- a/src/servers.cpp +++ b/src/servers.cpp @@ -161,6 +161,8 @@ bool serverrec::BeginLink(char* targethost, int newport, char* password, char* s connector.SetState(STATE_NOAUTH_OUTBOUND); connector.SetHostAndPort(targethost, newport); this->connectors.push_back(connector); + // this packet isn't actually sent until the socket connects -- the STATE_NOAUTH_OUTBOUND state + // queues outbound data until the socket is polled as writeable (e.g. the connection is established) return this->SendPacket(connect, servername); } else @@ -250,7 +252,15 @@ void serverrec::FlushWriteBuffers() { for (int i = 0; i < this->connectors.size(); i++) { - if (this->connectors[i].GetState() != STATE_DISCONNECTED) + // don't try and ping a NOAUTH_OUTBOUND state, its not authed yet! + if (this->connectors[i].GetState() != STATE_NOAUTH_OUTBOUND) + { + // however if we reach this timer its connected timed out :) + WriteOpers("*** Connection to %s timed out",this->connectors[i].GetServerName().c_str()); + DoSplit(this->connectors[i].GetServerName().c_str()); + return; + } + else if (this->connectors[i].GetState() != STATE_DISCONNECTED) { if (!this->connectors[i].CheckPing()) { |