remove panic from Debug of StreamRef is mutex is poisoned
This commit is contained in:
		| @@ -734,12 +734,20 @@ where | ||||
|     P: Peer, | ||||
| { | ||||
|     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | ||||
|         let me = self.inner.lock().unwrap(); | ||||
|         let stream = &me.store[self.key]; | ||||
|         fmt.debug_struct("StreamRef") | ||||
|             .field("stream_id", &stream.id) | ||||
|             .field("ref_count", &stream.ref_count) | ||||
|             .finish() | ||||
|         match self.inner.lock() { | ||||
|             Ok(me) => { | ||||
|                 let stream = &me.store[self.key]; | ||||
|                 fmt.debug_struct("StreamRef") | ||||
|                     .field("stream_id", &stream.id) | ||||
|                     .field("ref_count", &stream.ref_count) | ||||
|                     .finish() | ||||
|             }, | ||||
|             Err(_poisoned) => { | ||||
|                 fmt.debug_struct("StreamRef") | ||||
|                     .field("inner", &"<Poisoned>") | ||||
|                     .finish() | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user