summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-03-11 17:27:20 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-03-11 17:27:20 +0000
commitdb20c20a945e2107e1a9c66d62127c0833075ea8 (patch)
tree2e15237ca90c41af2bc10b19f47e4fa0ff61d8bd
parent871dd3c93bba5a8b60e9d785815dfbc579122652 (diff)
Re-enterance safety
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3665 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/socket.cpp8
-rwxr-xr-xsrc/svn-rev.sh2
2 files changed, 9 insertions, 1 deletions
diff --git a/src/socket.cpp b/src/socket.cpp
index d4cdb0a18..f4e6a5a6a 100644
--- a/src/socket.cpp
+++ b/src/socket.cpp
@@ -147,6 +147,7 @@ bool InspSocket::DoResolve()
this->Close();
this->state = I_ERROR;
this->OnError(I_ERR_RESOLVE);
+ this->fd = -1;
return false;
}
return this->DoConnect();
@@ -163,6 +164,7 @@ bool InspSocket::DoConnect()
log(DEBUG,"Cant socket()");
this->state = I_ERROR;
this->OnError(I_ERR_SOCKET);
+ this->fd = -1;
return false;
}
@@ -184,6 +186,7 @@ bool InspSocket::DoConnect()
this->OnError(I_ERR_CONNECT);
this->state = I_ERROR;
this->Close();
+ this->fd = -1;
return false;
}
}
@@ -275,6 +278,7 @@ bool InspSocket::FlushWriteBuffer()
log(DEBUG,"Write error on socket: %s",strerror(errno));
this->OnError(I_ERR_WRITE);
this->state = I_ERROR;
+ this->fd = -1;
return true;
}
}
@@ -295,6 +299,7 @@ bool InspSocket::Timeout(time_t current)
this->OnError(I_ERR_TIMEOUT);
timeout = true;
this->state = I_ERROR;
+ this->fd = -1;
return true;
}
return this->FlushWriteBuffer();
@@ -305,6 +310,9 @@ bool InspSocket::Poll()
int incoming = -1;
bool n = true;
+ if ((fd < 0) || (fd > MAX_DESCRIPTORS))
+ return false;
+
switch (this->state)
{
case I_RESOLVING:
diff --git a/src/svn-rev.sh b/src/svn-rev.sh
index 846663619..5e819f84a 100755
--- a/src/svn-rev.sh
+++ b/src/svn-rev.sh
@@ -1 +1 @@
-echo 3661
+echo 3664