mirror of
https://github.com/zeromq/libzmq.git
synced 2025-03-10 07:56:09 +00:00
problem: terminating conn doesn't make sense in disconnected protocol
This commit is contained in:
parent
8cd64b76e4
commit
d791932635
@ -97,7 +97,7 @@ int zmq::dgram_t::xsend (msg_t *msg_)
|
|||||||
errno_assert (rc == 0);
|
errno_assert (rc == 0);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If this is the first part of the message it's the ID of the
|
// If this is the first part of the message it's the ID of the
|
||||||
// peer to send the message to.
|
// peer to send the message to.
|
||||||
if (!more_out) {
|
if (!more_out) {
|
||||||
@ -115,25 +115,13 @@ int zmq::dgram_t::xsend (msg_t *msg_)
|
|||||||
// This is the last part of the message.
|
// This is the last part of the message.
|
||||||
more_out = false;
|
more_out = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close the remote connection if user has asked to do so
|
// Push the message into the pipe.
|
||||||
// by sending zero length message.
|
|
||||||
// Pending messages in the pipe will be dropped (on receiving term- ack)
|
|
||||||
if (msg_->size () == 0) {
|
|
||||||
pipe->terminate (false);
|
|
||||||
int rc = msg_->close ();
|
|
||||||
errno_assert (rc == 0);
|
|
||||||
rc = msg_->init ();
|
|
||||||
errno_assert (rc == 0);
|
|
||||||
pipe = NULL;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
// Push the message into the pipe.
|
|
||||||
if (!pipe->write (msg_)) {
|
if (!pipe->write (msg_)) {
|
||||||
errno = EAGAIN;
|
errno = EAGAIN;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(msg_->flags () & msg_t::more))
|
if (!(msg_->flags () & msg_t::more))
|
||||||
pipe->flush ();
|
pipe->flush ();
|
||||||
|
|
||||||
@ -149,7 +137,7 @@ int zmq::dgram_t::xrecv (msg_t *msg_)
|
|||||||
// Deallocate old content of the message.
|
// Deallocate old content of the message.
|
||||||
int rc = msg_->close ();
|
int rc = msg_->close ();
|
||||||
errno_assert (rc == 0);
|
errno_assert (rc == 0);
|
||||||
|
|
||||||
if (!pipe || !pipe->read (msg_)) {
|
if (!pipe || !pipe->read (msg_)) {
|
||||||
// Initialise the output parameter to be a 0-byte message.
|
// Initialise the output parameter to be a 0-byte message.
|
||||||
rc = msg_->init ();
|
rc = msg_->init ();
|
||||||
@ -159,7 +147,7 @@ int zmq::dgram_t::xrecv (msg_t *msg_)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
last_in = pipe;
|
last_in = pipe;
|
||||||
|
|
||||||
if (prefetched) {
|
if (prefetched) {
|
||||||
msg_->reset_flags (msg_t::more);
|
msg_->reset_flags (msg_t::more);
|
||||||
prefetched = false;
|
prefetched = false;
|
||||||
@ -188,7 +176,7 @@ bool zmq::dgram_t::xhas_out ()
|
|||||||
{
|
{
|
||||||
//if (more_out)
|
//if (more_out)
|
||||||
// return false;
|
// return false;
|
||||||
|
|
||||||
if (!pipe)
|
if (!pipe)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user