summaryrefslogtreecommitdiff
path: root/src/inspsocket.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-05-03 09:28:01 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-05-03 09:28:01 +0000
commit14004479dc1d471c4388f0ab7f86f869ba7f098a (patch)
tree12678fda8217ae43ee5ab9882797588470194597 /src/inspsocket.cpp
parent7eb84435ee644dc174b7914263c47db51e2e0e7b (diff)
Checks for negative fd's when adding them to the socketengine so we can generate less debug output
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3929 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/inspsocket.cpp')
-rw-r--r--src/inspsocket.cpp30
1 files changed, 21 insertions, 9 deletions
diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp
index 31605b9f0..74931cee3 100644
--- a/src/inspsocket.cpp
+++ b/src/inspsocket.cpp
@@ -47,8 +47,11 @@ InspSocket::InspSocket(int newfd, char* ip)
this->state = I_CONNECTED;
strlcpy(this->IP,ip,MAXBUF);
this->ClosePending = false;
- ServerInstance->SE->AddFd(this->fd,true,X_ESTAB_MODULE);
- socket_ref[this->fd] = this;
+ if (this->fd > -1)
+ {
+ ServerInstance->SE->AddFd(this->fd,true,X_ESTAB_MODULE);
+ socket_ref[this->fd] = this;
+ }
}
InspSocket::InspSocket(const std::string &ahost, int aport, bool listening, unsigned long maxtime) : fd(-1)
@@ -80,8 +83,11 @@ InspSocket::InspSocket(const std::string &ahost, int aport, bool listening, unsi
else
{
this->state = I_LISTENING;
- ServerInstance->SE->AddFd(this->fd,true,X_ESTAB_MODULE);
- socket_ref[this->fd] = this;
+ if (this->fd > -1)
+ {
+ ServerInstance->SE->AddFd(this->fd,true,X_ESTAB_MODULE);
+ socket_ref[this->fd] = this;
+ }
log(DEBUG,"New socket now in I_LISTENING state");
return;
}
@@ -187,9 +193,12 @@ bool InspSocket::DoConnect()
}
}
this->state = I_CONNECTING;
- ServerInstance->SE->AddFd(this->fd,false,X_ESTAB_MODULE);
- socket_ref[this->fd] = this;
- this->SetQueues(this->fd);
+ if (this->fd > -1)
+ {
+ ServerInstance->SE->AddFd(this->fd,false,X_ESTAB_MODULE);
+ socket_ref[this->fd] = this;
+ this->SetQueues(this->fd);
+ }
log(DEBUG,"Returning true from InspSocket::DoConnect");
return true;
}
@@ -355,8 +364,11 @@ bool InspSocket::Poll()
/* Our socket was in write-state, so delete it and re-add it
* in read-state.
*/
- ServerInstance->SE->DelFd(this->fd);
- ServerInstance->SE->AddFd(this->fd,true,X_ESTAB_MODULE);
+ if (this->fd > -1)
+ {
+ ServerInstance->SE->DelFd(this->fd);
+ ServerInstance->SE->AddFd(this->fd,true,X_ESTAB_MODULE);
+ }
return this->OnConnected();
break;
case I_LISTENING: