From 06bdf2c4f96a6324b3fe667cebb03d44cd100a73 Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Fri, 16 Sep 2011 09:29:43 +0200 Subject: Check message syntax in REQ asynchronously This patch adds support for checking messages as they arrive (as opposed to when they are recv'd by the user) and drop the connection if they are malformed. It also uses this new feature to check for validity of inbound messages in REQ socket. Signed-off-by: Martin Sustrik --- src/encoder.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/encoder.hpp') diff --git a/src/encoder.hpp b/src/encoder.hpp index f7e3cbc..949cbdc 100644 --- a/src/encoder.hpp +++ b/src/encoder.hpp @@ -142,11 +142,20 @@ namespace zmq private: + // Where to get the data to write from. unsigned char *write_pos; + + // How much data to write before next step should be executed. size_t to_write; + + // Next step. If set to NULL, it means that associated data stream + // is dead. step_t next; + + // If true, first byte of the message is being written. bool beginning; + // The buffer for encoded data. size_t bufsize; unsigned char *buf; -- cgit v1.2.3