Commit 3e37d7e1 authored by eta's avatar eta
Browse files

Merge branch 'debug-datastream' into 'main'

tor-proto datastream: Do not dump packet data in DataWriterImpl

See merge request !353
parents 3ac6ee71 78ab634e
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@ use tokio_crate::io::{AsyncRead as TokioAsyncRead, AsyncWrite as TokioAsyncWrite
#[cfg(feature = "tokio")]
use tokio_util::compat::{FuturesAsyncReadCompatExt, FuturesAsyncWriteCompatExt};

use std::fmt;
use std::fmt::{self, Debug};
use std::io::Result as IoResult;
use std::pin::Pin;

@@ -268,7 +268,7 @@ enum DataWriterState {
    Flushing(Pin<Box<dyn Future<Output = (DataWriterImpl, Result<()>)> + Send>>),
}

impl fmt::Debug for DataWriterState {
impl Debug for DataWriterState {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        match self {
            DataWriterState::Closed => write!(f, "DataWriterState::Closed"),
@@ -279,7 +279,6 @@ impl fmt::Debug for DataWriterState {
}

/// Internal: the write part of a DataStream
#[derive(Debug)]
struct DataWriterImpl {
    /// The underlying StreamTarget object.
    s: StreamTarget,
@@ -295,6 +294,15 @@ struct DataWriterImpl {
    n_pending: usize,
}

impl Debug for DataWriterImpl {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        f.debug_struct("DataWriterImpl")
            .field("sr", &self.s)
            .field("n_pending", &self.n_pending)
            .finish_non_exhaustive()
    }
}

impl DataWriter {
    /// Helper for poll_flush() and poll_close(): Performs a flush, then
    /// closes the stream if should_close is true.
@@ -479,7 +487,6 @@ impl std::fmt::Debug for DataReaderState {
}

/// Wrapper for the read part of a DataStream
#[derive(Debug)]
struct DataReaderImpl {
    /// The underlying StreamReader object.
    s: StreamReader,