mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-10 02:59:01 -04:00
Backport of stability fix for 'connection refused' on autoconnect/connect
git-svn-id: http://svn.inspircd.org/repository/branches/1_0_stable@3794 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
parent
0e0353a5ed
commit
acc947b584
@ -3221,13 +3221,13 @@ class ModuleSpanningTree : public Module
|
||||
// an autoconnected server is not connected. Check if its time to connect it
|
||||
WriteOpers("*** AUTOCONNECT: Auto-connecting server \002%s\002 (%lu seconds until next attempt)",x->Name.c_str(),x->AutoConnect);
|
||||
TreeSocket* newsocket = new TreeSocket(x->IPAddr,x->Port,false,10,x->Name.c_str());
|
||||
if (newsocket->GetState() != I_ERROR)
|
||||
if (newsocket->GetFd() > -1)
|
||||
{
|
||||
Srv->AddSocket(newsocket);
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteOpers("*** AUTOCONNECT: Error autoconnecting \002%s\002.",x->Name.c_str());
|
||||
WriteOpers("*** AUTOCONNECT: Error autoconnecting \002%s\002: %s.",x->Name.c_str(),strerror(errno));
|
||||
delete newsocket;
|
||||
}
|
||||
}
|
||||
@ -3283,13 +3283,13 @@ class ModuleSpanningTree : public Module
|
||||
{
|
||||
WriteServ(user->fd,"NOTICE %s :*** CONNECT: Connecting to server: \002%s\002 (%s:%d)",user->nick,x->Name.c_str(),(x->HiddenFromStats ? "<hidden>" : x->IPAddr.c_str()),x->Port);
|
||||
TreeSocket* newsocket = new TreeSocket(x->IPAddr,x->Port,false,10,x->Name.c_str());
|
||||
if (newsocket->GetState() != I_ERROR)
|
||||
if (newsocket->GetFd() > -1)
|
||||
{
|
||||
Srv->AddSocket(newsocket);
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteServ(user->fd,"NOTICE %s :*** CONNECT: Error connecting \002%s\002.",user->nick,x->Name.c_str());
|
||||
WriteServ(user->fd,"NOTICE %s :*** CONNECT: Error connecting \002%s\002: %s.",user->nick,x->Name.c_str(),strerror(errno));
|
||||
delete newsocket;
|
||||
}
|
||||
return 1;
|
||||
|
@ -188,8 +188,8 @@ bool InspSocket::DoConnect()
|
||||
{
|
||||
log(DEBUG,"Error connect() %d: %s",this->fd,strerror(errno));
|
||||
this->OnError(I_ERR_CONNECT);
|
||||
this->state = I_ERROR;
|
||||
this->Close();
|
||||
this->state = I_ERROR;
|
||||
this->fd = -1;
|
||||
this->ClosePending = true;
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user