From ef90d566f010d9fd997ccd2d0c68081efd26db32 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sat, 6 Feb 2016 11:18:51 -0800 Subject: Don't assert free returns 0 in a dtor This may return EAGAIN, but we'll just make things worse by aborting. Instead just unfortunately leak the memory as there's not much more that can be done. --- tests/channel.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests') diff --git a/tests/channel.rs b/tests/channel.rs index 94b7cf8..9cced14 100644 --- a/tests/channel.rs +++ b/tests/channel.rs @@ -106,3 +106,21 @@ fn forward() { assert_eq!(r, [4, 5, 6]); t.join().ok().unwrap(); } + +#[test] +fn drop_nonblocking() { + let listener = TcpListener::bind("127.0.0.1:0").unwrap(); + let addr = listener.local_addr().unwrap(); + + let (_tcp, sess) = ::authed_session(); + sess.set_blocking(false); + + let t = thread::spawn(move || { + let _s = listener.accept().unwrap(); + }); + + let _ = sess.channel_direct_tcpip("127.0.0.1", addr.port(), None); + drop(sess); + + t.join().unwrap(); +} -- cgit v1.2.3