summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/modules/m_spanningtree.cpp8
-rw-r--r--src/socket.cpp2
2 files changed, 5 insertions, 5 deletions
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp
index 4830d715d..31df4852d 100644
--- a/src/modules/m_spanningtree.cpp
+++ b/src/modules/m_spanningtree.cpp
@@ -3220,13 +3220,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;
}
}
@@ -3282,13 +3282,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;
diff --git a/src/socket.cpp b/src/socket.cpp
index e1f0d2c23..767e2c468 100644
--- a/src/socket.cpp
+++ b/src/socket.cpp
@@ -189,8 +189,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;