From c91bf25645b27fb903886093b27fa153c60be2fd Mon Sep 17 00:00:00 2001 From: Dhammika Pathirana Date: Thu, 20 Jan 2011 07:52:40 +0100 Subject: Fix handle connection reset during session init Patch to handle nmap version probes. Signed-off-by: Dhammika Pathirana --- src/decoder.hpp | 4 ++++ src/zmq_engine.cpp | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/decoder.hpp b/src/decoder.hpp index 9da6f72..80987a8 100644 --- a/src/decoder.hpp +++ b/src/decoder.hpp @@ -91,6 +91,10 @@ namespace zmq // bytes actually processed. inline size_t process_buffer (unsigned char *data_, size_t size_) { + // Check if we had an error in previous attempt. + if (unlikely (!(static_cast (this)->next))) + return (size_t) -1; + // In case of zero-copy simply adjust the pointers, no copying // is required. Also, run the state machine in case all the data // were processed. diff --git a/src/zmq_engine.cpp b/src/zmq_engine.cpp index dde9c4b..c51b7ad 100644 --- a/src/zmq_engine.cpp +++ b/src/zmq_engine.cpp @@ -151,7 +151,7 @@ void zmq::zmq_engine_t::in_event () inout->flush (); } - if (disconnection) + if (inout && disconnection) error (); } -- cgit v1.2.3