[zeromq-dev] [PATCH] Fix handle connection reset during session init
Dhammika Pathirana
dhammika at gmail.com
Wed Jan 19 07:12:38 CET 2011
Patch to handle nmap version probes.
Signed-off-by: Dhammika Pathirana <dhammika at gmail.com>
---
src/decoder.hpp | 4 ++++
src/zmq_engine.cpp | 2 +-
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 ();
}
--
1.7.0.4
Dhammika
More information about the zeromq-dev
mailing list