summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-05-23 17:52:46 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-05-23 17:52:46 +0000
commit45b07a069108d661f7d3b63b040e4db5166a2dd8 (patch)
treea7905796cc4d41f5b10fe735232bed1d8ea55828 /include
parentb8e97ead2880337ea270ed36b785b6103c46a5c2 (diff)
Output buffering on server connections
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1475 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include')
-rw-r--r--include/connection.h35
-rw-r--r--include/servers.h4
2 files changed, 38 insertions, 1 deletions
diff --git a/include/connection.h b/include/connection.h
index ef18ec7c0..420839b0d 100644
--- a/include/connection.h
+++ b/include/connection.h
@@ -85,6 +85,14 @@ class ircd_connector : public Extensible
*/
std::string version;
+ /** SendQ of the outbound connector, does not have a limit
+ */
+ std::string sendq;
+
+ /** Write error of connection
+ */
+ std::string WriteError;
+
public:
/** IRCD Buffer for input characters, holds as many lines as are
@@ -111,7 +119,10 @@ class ircd_connector : public Extensible
* whilever both servers are connected to B.
*/
std::vector<std::string> routes;
-
+
+ /** Constructor clears the sendq and initialises the fd to -1
+ */
+ ircd_connector();
/** Create an outbound connection to a listening socket
*/
@@ -204,6 +215,28 @@ class ircd_connector : public Extensible
* If the server has no version string an empty string is returned.
*/
std::string GetVersionString();
+
+ /** Adds data to the connection's sendQ to be flushed later
+ * Fails if there is an error pending on the connection.
+ */
+ bool AddWriteBuf(std::string data);
+
+ /** Flushes as much of the data from the buffer as possible,
+ * and advances the queue pointer to what is left.
+ */
+ bool FlushWriteBuf();
+
+ /** Sets the error string for this connection
+ */
+ void SetWriteError(std::string error);
+
+ /** Gets the error string for this connection
+ */
+ std::string GetWriteError();
+
+ /** Returns true if there is data to be written that hasn't been sent yet
+ */
+ bool HasBufferedOutput();
};
diff --git a/include/servers.h b/include/servers.h
index e7d7f2547..e9940704c 100644
--- a/include/servers.h
+++ b/include/servers.h
@@ -116,6 +116,10 @@ class serverrec : public connection
* (reserved for core use)
*/
bool AddIncoming(int fd,char* targethost, int sourceport);
+
+ /** Flushes all data waiting to be written for all of this server's connections
+ */
+ void FlushWriteBuffers();
};
#endif