]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/socket.h
Convert more by-values to const references, optimise ConfigReader a bit
[user/henk/code/inspircd.git] / include / socket.h
index 1c343f122bda48636a7313564d1d4c6c849246cf..e36bbd2312ea67e93181aab0ede50043a6974591 100644 (file)
@@ -23,6 +23,7 @@
 #include <sstream>
 #include <string>
 #include "dns.h"
+#include <deque>
 
 /**
  * States which a socket may be in
@@ -32,7 +33,7 @@ enum InspSocketState { I_DISCONNECTED, I_RESOLVING, I_CONNECTING, I_CONNECTED, I
 /**
  * Error types which a socket may exhibit
  */
-enum InspSocketError { I_ERR_TIMEOUT, I_ERR_SOCKET, I_ERR_CONNECT, I_ERR_BIND, I_ERR_RESOLVE };
+enum InspSocketError { I_ERR_TIMEOUT, I_ERR_SOCKET, I_ERR_CONNECT, I_ERR_BIND, I_ERR_RESOLVE, I_ERR_WRITE };
 
 /**
  * InspSocket is an extendable socket class which modules
@@ -114,7 +115,7 @@ private:
        /**
         * The output buffer for this socket
         */
-       std::string Buffer;
+       std::deque<std::string> outbuffer;
 
        /**
         * The IP address being connected
@@ -143,7 +144,7 @@ private:
 
        /** Flushes the write buffer
         */
-       void FlushWriteBuffer();
+       bool FlushWriteBuffer();
 
        void SetQueues(int nfd);
 
@@ -176,7 +177,7 @@ public:
         * @param listening true to listen on the given host:port pair, or false to connect to them
         * @param maxtime Number of seconds to wait, if connecting, before the connection times out and an OnTimeout() event is generated
         */
-       InspSocket(std::string host, int port, bool listening, unsigned long maxtime);
+       InspSocket(const std::string &host, int port, bool listening, unsigned long maxtime);
 
        /**
         * This method is called when an outbound
@@ -263,7 +264,7 @@ public:
         * returns or linefeeds are appended to the string.
         * @param data The data to send
         */
-       virtual int Write(std::string data);
+       virtual int Write(const std::string &data);
 
        /**
         * If your socket is a listening socket, when a new