Commit f674c926 authored by Martin Sustrik's avatar Martin Sustrik

ZMQII-2: SIGSEGV in zmq_connecter_init_t::read

parent 93e70ee5
...@@ -70,7 +70,7 @@ bool zmq::zmq_decoder_t::message_ready () ...@@ -70,7 +70,7 @@ bool zmq::zmq_decoder_t::message_ready ()
{ {
// Message is completely read. Push it further and start reading // Message is completely read. Push it further and start reading
// new message. // new message.
if (!destination->write (&in_progress)) if (!destination || !destination->write (&in_progress))
return false; return false;
next_step (tmpbuf, 1, &zmq_decoder_t::one_byte_size_ready); next_step (tmpbuf, 1, &zmq_decoder_t::one_byte_size_ready);
......
...@@ -54,7 +54,7 @@ bool zmq::zmq_encoder_t::message_ready () ...@@ -54,7 +54,7 @@ bool zmq::zmq_encoder_t::message_ready ()
// Note that new state is set only if write is successful. That way // Note that new state is set only if write is successful. That way
// unsuccessful write will cause retry on the next state machine // unsuccessful write will cause retry on the next state machine
// invocation. // invocation.
if (!source->read (&in_progress)) if (!source || !source->read (&in_progress))
return false; return false;
size_t size = zmq_msg_size (&in_progress); size_t size = zmq_msg_size (&in_progress);
......
...@@ -66,6 +66,8 @@ void zmq::zmq_engine_t::plug (i_inout *inout_) ...@@ -66,6 +66,8 @@ void zmq::zmq_engine_t::plug (i_inout *inout_)
void zmq::zmq_engine_t::unplug () void zmq::zmq_engine_t::unplug ()
{ {
rm_fd (handle); rm_fd (handle);
encoder.set_inout (NULL);
decoder.set_inout (NULL);
inout = NULL; inout = NULL;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment