diff options
author | Alex Crichton <alex@alexcrichton.com> | 2016-02-06 11:18:51 -0800 |
---|---|---|
committer | Alex Crichton <alex@alexcrichton.com> | 2016-02-06 11:18:51 -0800 |
commit | ef90d566f010d9fd997ccd2d0c68081efd26db32 (patch) | |
tree | 16efe41b754bf69655fee17ec1c58997c09b88ef /tests | |
parent | 8fda2fcd6af9a7dc3add386f522ed38388774f16 (diff) | |
download | ssh2-rs-ef90d566f010d9fd997ccd2d0c68081efd26db32.zip |
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.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/channel.rs | 18 |
1 files changed, 18 insertions, 0 deletions
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(); +} |