File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ mod openssl;
1111mod security_framework;
1212
1313/// A trait implemented by SSL adaptors.
14- pub trait StreamWrapper : Read + Write + Send {
14+ pub trait StreamWrapper : fmt :: Debug + Read + Write + Send {
1515 /// Returns a reference to the underlying `Stream`.
1616 fn get_ref ( & self ) -> & Stream ;
1717
Original file line number Diff line number Diff line change @@ -826,6 +826,7 @@ impl fmt::Debug for Connection {
826826 fn fmt ( & self , fmt : & mut fmt:: Formatter ) -> fmt:: Result {
827827 let conn = self . conn . borrow ( ) ;
828828 fmt. debug_struct ( "Connection" )
829+ . field ( "stream" , & conn. stream . get_ref ( ) )
829830 . field ( "cancel_data" , & conn. cancel_data )
830831 . field ( "notifications" , & conn. notifications . len ( ) )
831832 . field ( "transaction_depth" , & conn. trans_depth )
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ use byteorder::ReadBytesExt;
22use net2:: TcpStreamExt ;
33use std:: io;
44use std:: io:: prelude:: * ;
5+ use std:: fmt;
56use std:: net:: TcpStream ;
67use std:: time:: Duration ;
78use bufstream:: BufStream ;
@@ -43,6 +44,16 @@ impl ReadTimeout for BufStream<Box<StreamWrapper>> {
4344/// Unix platforms and `AsRawSocket` on Windows platforms.
4445pub struct Stream ( InternalStream ) ;
4546
47+ impl fmt:: Debug for Stream {
48+ fn fmt ( & self , fmt : & mut fmt:: Formatter ) -> fmt:: Result {
49+ match self . 0 {
50+ InternalStream :: Tcp ( ref s) => fmt:: Debug :: fmt ( s, fmt) ,
51+ #[ cfg( feature = "unix_socket" ) ]
52+ InternalStream :: Unix ( ref s) => fmt:: Debug :: fmt ( s, fmt) ,
53+ }
54+ }
55+ }
56+
4657impl Read for Stream {
4758 fn read ( & mut self , buf : & mut [ u8 ] ) -> io:: Result < usize > {
4859 self . 0 . read ( buf)
You can’t perform that action at this time.
0 commit comments