]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/users.cpp
Customizable by-byte-size recvq stuff
[user/henk/code/inspircd.git] / src / users.cpp
index 0e676600edb5b6571a67375644b3e844d7419228..0060b45ee4f6c408e4921f5a11637cba5f1d7537 100644 (file)
@@ -183,6 +183,11 @@ bool userrec::AddBuffer(std::string a)
                if (recvq[i++] == '\n')
                        break;
        }
+       if (recvq.length() > this->recvqmax)
+       {
+               this->SetWriteError("RecvQ exceeded");
+               WriteOpers("*** User %s RecvQ of %d exceeds connect class maximum of %d",this->nick,recvq.length(),this->recvqmax);
+       }
        // return false if we've had more than 600 characters WITHOUT
        // a carriage return (this is BAD, drop the socket)
        return (i < 600);
@@ -220,6 +225,14 @@ std::string userrec::GetBuffer()
 
 void userrec::AddWriteBuf(std::string data)
 {
+       if (this->GetWriteError() != "")
+               return;
+       if (sendq.length() + data.length() > this->sendqmax)
+       {
+               WriteOpers("*** User %s SendQ of %d exceeds connect class maximum of %d",this->nick,sendq.length() + data.length(),this->sendqmax);
+               this->SetWriteError("SendQ exceeded");
+               return;
+       }
         std::stringstream stream;
         stream << sendq << data;
         sendq = stream.str();