summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDhammika Pathirana <dhammika@gmail.com>2011-01-20 07:52:40 +0100
committerMartin Sustrik <sustrik@250bpm.com>2011-01-20 07:52:40 +0100
commitc91bf25645b27fb903886093b27fa153c60be2fd (patch)
tree44d7870ea0ed2184f095d892e25295a1398bb1d0
parent56bdba592cf336b2bd4241a2b8e331cd38a089e4 (diff)
Fix handle connection reset during session init
Patch to handle nmap version probes. Signed-off-by: Dhammika Pathirana <dhammika@gmail.com>
-rw-r--r--src/decoder.hpp4
-rw-r--r--src/zmq_engine.cpp2
2 files changed, 5 insertions, 1 deletions
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 <T*> (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 ();
}