mirror of
https://github.com/zeromq/libzmq.git
synced 2025-03-03 12:58:05 +01:00
Revert "Problem: REP leaves label msgs for dead REQ in pipe"
This commit is contained in:
parent
75cc2015d1
commit
1489fc1ac5
@ -273,9 +273,6 @@ int zmq::router_t::xsend (msg_t *msg_)
|
|||||||
// Message failed to send - we must close it ourselves.
|
// Message failed to send - we must close it ourselves.
|
||||||
int rc = msg_->close ();
|
int rc = msg_->close ();
|
||||||
errno_assert (rc == 0);
|
errno_assert (rc == 0);
|
||||||
// HWM was checked before, so the pipe must be gone. Roll back
|
|
||||||
// messages that were piped, for example REP labels.
|
|
||||||
current_out->rollback ();
|
|
||||||
current_out = NULL;
|
current_out = NULL;
|
||||||
} else {
|
} else {
|
||||||
if (!more_out) {
|
if (!more_out) {
|
||||||
|
@ -29,48 +29,9 @@
|
|||||||
|
|
||||||
#include "testutil.hpp"
|
#include "testutil.hpp"
|
||||||
|
|
||||||
void test_leak (void)
|
int main (void)
|
||||||
{
|
|
||||||
char my_endpoint[256];
|
|
||||||
void *ctx = zmq_ctx_new ();
|
|
||||||
assert (ctx);
|
|
||||||
|
|
||||||
void *sb = zmq_socket (ctx, ZMQ_REP);
|
|
||||||
assert (sb);
|
|
||||||
int rc = zmq_bind (sb, "ipc://*");
|
|
||||||
assert (rc == 0);
|
|
||||||
size_t len = sizeof(my_endpoint);
|
|
||||||
rc = zmq_getsockopt (sb, ZMQ_LAST_ENDPOINT, my_endpoint, &len);
|
|
||||||
assert (rc == 0);
|
|
||||||
|
|
||||||
void *sc = zmq_socket (ctx, ZMQ_REQ);
|
|
||||||
assert (sc);
|
|
||||||
rc = zmq_connect (sc, my_endpoint);
|
|
||||||
assert (rc == 0);
|
|
||||||
|
|
||||||
rc = s_send (sc, "leakymsg");
|
|
||||||
assert (rc == strlen ("leakymsg"));
|
|
||||||
|
|
||||||
char *buf = s_recv (sb);
|
|
||||||
free (buf);
|
|
||||||
|
|
||||||
rc = zmq_close (sc);
|
|
||||||
assert (rc == 0);
|
|
||||||
|
|
||||||
msleep (SETTLE_TIME);
|
|
||||||
|
|
||||||
rc = s_send (sb, "leakymsg");
|
|
||||||
assert (rc == strlen ("leakymsg"));
|
|
||||||
|
|
||||||
rc = zmq_close (sb);
|
|
||||||
assert (rc == 0);
|
|
||||||
|
|
||||||
rc = zmq_ctx_term (ctx);
|
|
||||||
assert (rc == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void test_simple (void)
|
|
||||||
{
|
{
|
||||||
|
setup_test_environment();
|
||||||
char my_endpoint[256];
|
char my_endpoint[256];
|
||||||
void *ctx = zmq_ctx_new ();
|
void *ctx = zmq_ctx_new ();
|
||||||
assert (ctx);
|
assert (ctx);
|
||||||
@ -98,15 +59,6 @@ void test_simple (void)
|
|||||||
|
|
||||||
rc = zmq_ctx_term (ctx);
|
rc = zmq_ctx_term (ctx);
|
||||||
assert (rc == 0);
|
assert (rc == 0);
|
||||||
}
|
|
||||||
|
|
||||||
int main (void)
|
|
||||||
{
|
|
||||||
setup_test_environment();
|
|
||||||
|
|
||||||
test_simple ();
|
|
||||||
|
|
||||||
test_leak ();
|
|
||||||
|
|
||||||
return 0 ;
|
return 0 ;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user