summaryrefslogtreecommitdiff
path: root/src/decoder.hpp
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 /src/decoder.hpp
parent56bdba592cf336b2bd4241a2b8e331cd38a089e4 (diff)
Fix handle connection reset during session init
Patch to handle nmap version probes. Signed-off-by: Dhammika Pathirana <dhammika@gmail.com>
Diffstat (limited to 'src/decoder.hpp')
-rw-r--r--src/decoder.hpp4
1 files changed, 4 insertions, 0 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.