summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2015-06-06 14:31:05 +0200
committerAttila Molnar <attilamolnar@hush.com>2015-06-06 14:31:05 +0200
commit1f0485039a276ad1c2fa3d53d284e3a87940ec77 (patch)
tree5689bf7bbcd023956ab67d4730428b1c746decce /include
parent0858cdd53cd1ec01c4539e9c36ef7dd9fab4aa16 (diff)
Convert all code to use StreamSocket::SendQueue
Let OnStreamSocketWrite see the entire sendq instead of one element at a time
Diffstat (limited to 'include')
-rw-r--r--include/inspsocket.h13
-rw-r--r--include/iohook.h3
2 files changed, 8 insertions, 8 deletions
diff --git a/include/inspsocket.h b/include/inspsocket.h
index 43bd3e3ab..53eca2e91 100644
--- a/include/inspsocket.h
+++ b/include/inspsocket.h
@@ -212,11 +212,10 @@ class CoreExport StreamSocket : public EventHandler
/** The IOHook that handles raw I/O for this socket, or NULL */
IOHook* iohook;
- /** Private send queue. Note that individual strings may be shared
+ /** Send queue of the socket
*/
- std::deque<std::string> sendq;
- /** Length, in bytes, of the sendq */
- size_t sendq_len;
+ SendQueue sendq;
+
/** Error - if nonempty, the socket is dead, and this is the reason. */
std::string error;
@@ -232,7 +231,7 @@ class CoreExport StreamSocket : public EventHandler
protected:
std::string recvq;
public:
- StreamSocket() : iohook(NULL), sendq_len(0) {}
+ StreamSocket() : iohook(NULL) { }
IOHook* GetIOHook() const;
void AddIOHook(IOHook* hook);
void DelIOHook();
@@ -275,7 +274,9 @@ class CoreExport StreamSocket : public EventHandler
*/
bool GetNextLine(std::string& line, char delim = '\n');
/** Useful for implementing sendq exceeded */
- inline size_t getSendQSize() const { return sendq_len; }
+ size_t getSendQSize() const { return sendq.size(); }
+
+ SendQueue& GetSendQ() { return sendq; }
/**
* Close the socket, remove from socket engine, etc
diff --git a/include/iohook.h b/include/iohook.h
index ce7ca2a1b..cf27fcb0c 100644
--- a/include/iohook.h
+++ b/include/iohook.h
@@ -66,11 +66,10 @@ class IOHook : public classbase
* Called when a hooked stream has data to write, or when the socket
* engine returns it as writable
* @param sock The socket in question
- * @param sendq Data to send to the socket
* @return 1 if the sendq has been completely emptied, 0 if there is
* still data to send, and -1 if there was an error
*/
- virtual int OnStreamSocketWrite(StreamSocket* sock, std::string& sendq) = 0;
+ virtual int OnStreamSocketWrite(StreamSocket* sock) = 0;
/** Called immediately before any socket is closed. When this event is called, shutdown()
* has not yet been called on the socket.