X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning-net-tokio%2Fsrc%2Flib.rs;fp=lightning-net-tokio%2Fsrc%2Flib.rs;h=38b09a2886c2b825acec3cf4f4f741626f184139;hb=d66c70eed4c71119f9a44aa31b9f00d3677e7333;hp=45fe9b12f61b17a7b078805de1e6344efa91fbf3;hpb=50d12600b43c0c4a65547c6d37fca3efce0a12f2;p=rust-lightning diff --git a/lightning-net-tokio/src/lib.rs b/lightning-net-tokio/src/lib.rs index 45fe9b12..38b09a28 100644 --- a/lightning-net-tokio/src/lib.rs +++ b/lightning-net-tokio/src/lib.rs @@ -301,7 +301,7 @@ pub fn setup_inbound( { let remote_addr = get_addr_from_stream(&stream); let (reader, write_receiver, read_receiver, us) = Connection::new(stream); - #[cfg(debug_assertions)] + #[cfg(test)] let last_us = Arc::clone(&us); let handle_opt = if let Ok(_) = peer_manager.new_inbound_connection(SocketDescriptor::new(us.clone()), remote_addr) { @@ -322,8 +322,8 @@ pub fn setup_inbound( // socket shutdown(). Still, as a check during testing, to make sure tokio doesn't // keep too many wakers around, this makes sense. The race should be rare (we do // some work after shutdown()) and an error would be a major memory leak. - #[cfg(debug_assertions)] - assert!(Arc::try_unwrap(last_us).is_ok()); + #[cfg(test)] + debug_assert!(Arc::try_unwrap(last_us).is_ok()); } } } @@ -355,7 +355,7 @@ pub fn setup_outbound( { let remote_addr = get_addr_from_stream(&stream); let (reader, mut write_receiver, read_receiver, us) = Connection::new(stream); - #[cfg(debug_assertions)] + #[cfg(test)] let last_us = Arc::clone(&us); let handle_opt = if let Ok(initial_send) = peer_manager.new_outbound_connection(their_node_id, SocketDescriptor::new(us.clone()), remote_addr) { Some(tokio::spawn(async move { @@ -401,8 +401,8 @@ pub fn setup_outbound( // socket shutdown(). Still, as a check during testing, to make sure tokio doesn't // keep too many wakers around, this makes sense. The race should be rare (we do // some work after shutdown()) and an error would be a major memory leak. - #[cfg(debug_assertions)] - assert!(Arc::try_unwrap(last_us).is_ok()); + #[cfg(test)] + debug_assert!(Arc::try_unwrap(last_us).is_ok()); } } }