Instrument some functions to try to locate the panic
This commit is contained in:
parent
fa29fca917
commit
3e711ccc8a
|
@ -56,6 +56,7 @@ impl<T: std::fmt::Debug> MustUseOneshotSender<T> {
|
|||
/// Forwards `t` to `tx.send()`, and marks this sender as used.
|
||||
///
|
||||
/// Panics if `tx.send()` is used more than once.
|
||||
#[instrument(skip(self))]
|
||||
pub fn send(mut self, t: T) -> Result<(), T> {
|
||||
self.tx
|
||||
.take()
|
||||
|
@ -71,6 +72,7 @@ impl<T: std::fmt::Debug> MustUseOneshotSender<T> {
|
|||
/// Returns `tx.cancellation()`.
|
||||
///
|
||||
/// Panics if `tx.send()` has previously been used.
|
||||
#[instrument(skip(self))]
|
||||
pub fn cancellation(&mut self) -> oneshot::Cancellation<'_, T> {
|
||||
self.tx
|
||||
.as_mut()
|
||||
|
@ -83,6 +85,7 @@ impl<T: std::fmt::Debug> MustUseOneshotSender<T> {
|
|||
/// Returns `tx.is_canceled()`.
|
||||
///
|
||||
/// Panics if `tx.send()` has previously been used.
|
||||
#[instrument(skip(self))]
|
||||
pub fn is_canceled(&self) -> bool {
|
||||
self.tx
|
||||
.as_ref()
|
||||
|
@ -99,6 +102,7 @@ impl<T: std::fmt::Debug> From<oneshot::Sender<T>> for MustUseOneshotSender<T> {
|
|||
}
|
||||
|
||||
impl<T: std::fmt::Debug> Drop for MustUseOneshotSender<T> {
|
||||
#[instrument(skip(self))]
|
||||
fn drop(&mut self) {
|
||||
// is_canceled() will not panic, because we check is_none() first
|
||||
assert!(
|
||||
|
@ -126,6 +130,7 @@ impl Service<Request> for Client {
|
|||
}
|
||||
}
|
||||
|
||||
#[instrument(skip(self))]
|
||||
fn call(&mut self, request: Request) -> Self::Future {
|
||||
use futures::future::FutureExt;
|
||||
|
||||
|
|
|
@ -341,6 +341,7 @@ where
|
|||
Tx: Sink<Message, Error = SerializationError> + Unpin,
|
||||
{
|
||||
/// Consume this `Connection` to form a spawnable future containing its event loop.
|
||||
#[instrument(skip(self, peer_rx))]
|
||||
pub async fn run<Rx>(mut self, mut peer_rx: Rx)
|
||||
where
|
||||
Rx: Stream<Item = Result<Message, SerializationError>> + Unpin,
|
||||
|
@ -533,6 +534,7 @@ where
|
|||
/// remote peer.
|
||||
///
|
||||
/// NOTE: the caller should use .instrument(msg.span) to instrument the function.
|
||||
#[instrument(skip(self))]
|
||||
async fn handle_client_request(&mut self, req: ClientRequest) {
|
||||
trace!(?req.request);
|
||||
use Request::*;
|
||||
|
|
|
@ -188,6 +188,7 @@ where
|
|||
Poll::Ready(Ok(()))
|
||||
}
|
||||
|
||||
#[instrument(skip(self))]
|
||||
fn call(&mut self, req: (TcpStream, SocketAddr)) -> Self::Future {
|
||||
let (tcp_stream, addr) = req;
|
||||
|
||||
|
|
Loading…
Reference in New Issue