summaryrefslogtreecommitdiff
path: root/src/inspsocket.cpp
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-09-11 00:15:28 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-09-11 00:15:28 +0000
commitbd6158e7b044f853be0b493c0ccbfc7a5c05082e (patch)
tree07e1ab488b2ff8b91cf4b5942e54d8ec4e38f240 /src/inspsocket.cpp
parenta363c6f2bebc02ab553ee96b0e9e865e4f93e2d8 (diff)
Remove WaitingForWriteEvent, it seems to do *nothing* except confuse things. Also, don't close socket on http if FlushWriteBuf doesn't write it all in one go, in fact, don't try FlushWriteBuf at all - use the sockets default of waiting to be told it's safe to write data.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10509 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/inspsocket.cpp')
-rw-r--r--src/inspsocket.cpp24
1 files changed, 7 insertions, 17 deletions
diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp
index 0c3f3ea17..ea0534f24 100644
--- a/src/inspsocket.cpp
+++ b/src/inspsocket.cpp
@@ -20,7 +20,7 @@
bool BufferedSocket::Readable()
{
- return ((this->state != I_CONNECTING) && (this->WaitingForWriteEvent == false));
+ return (this->state != I_CONNECTING);
}
BufferedSocket::BufferedSocket(InspIRCd* SI)
@@ -28,7 +28,6 @@ BufferedSocket::BufferedSocket(InspIRCd* SI)
this->Timeout = NULL;
this->state = I_DISCONNECTED;
this->fd = -1;
- this->WaitingForWriteEvent = false;
this->Instance = SI;
}
@@ -38,7 +37,6 @@ BufferedSocket::BufferedSocket(InspIRCd* SI, int newfd, const char* ip)
this->fd = newfd;
this->state = I_CONNECTED;
strlcpy(this->IP,ip,MAXBUF);
- this->WaitingForWriteEvent = false;
this->Instance = SI;
if (this->fd > -1)
this->Instance->SE->AddFd(this);
@@ -50,7 +48,6 @@ BufferedSocket::BufferedSocket(InspIRCd* SI, const std::string &ipaddr, int apor
this->fd = -1;
this->Instance = SI;
strlcpy(host,ipaddr.c_str(),MAXBUF);
- this->WaitingForWriteEvent = false;
this->Timeout = NULL;
strlcpy(this->host,ipaddr.c_str(),MAXBUF);
@@ -98,7 +95,6 @@ BufferedSocket::BufferedSocket(InspIRCd* SI, const std::string &ipaddr, int apor
void BufferedSocket::WantWrite()
{
this->Instance->SE->WantWrite(this);
- this->WaitingForWriteEvent = true;
}
void BufferedSocket::SetQueues(int nfd)
@@ -595,7 +591,11 @@ bool BufferedSocket::OnConnected() { return true; }
void BufferedSocket::OnError(BufferedSocketError) { return; }
int BufferedSocket::OnDisconnect() { return 0; }
bool BufferedSocket::OnDataReady() { return true; }
-bool BufferedSocket::OnWriteReady() { return true; }
+bool BufferedSocket::OnWriteReady()
+{
+ // Default behaviour: just try write some.
+ return !this->FlushWriteBuffer();
+}
void BufferedSocket::OnTimeout() { return; }
void BufferedSocket::OnClose() { return; }
@@ -644,16 +644,6 @@ void BufferedSocket::HandleEvent(EventType et, int errornum)
}
break;
case EVENT_WRITE:
- if (this->WaitingForWriteEvent)
- {
- this->WaitingForWriteEvent = false;
- if (!this->OnWriteReady())
- {
- if (this->Instance->SocketCull.find(this) == this->Instance->SocketCull.end())
- this->Instance->SocketCull[this] = this;
- return;
- }
- }
if (this->state == I_CONNECTING)
{
/* This might look wrong as if we should be actually calling
@@ -667,7 +657,7 @@ void BufferedSocket::HandleEvent(EventType et, int errornum)
}
else
{
- if (this->FlushWriteBuffer())
+ if (!this->OnWriteReady())
{
if (this->Instance->SocketCull.find(this) == this->Instance->SocketCull.end())
this->Instance->SocketCull[this] = this;