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