File tree Expand file tree Collapse file tree 3 files changed +10
-5
lines changed
Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,13 @@ pub enum IpStackError {
2222 AcceptError ,
2323
2424 #[ error( "Send Error {0}" ) ]
25- SendError ( #[ from] tokio:: sync:: mpsc:: error:: SendError < crate :: stream:: IpStackStream > ) ,
25+ SendError ( #[ from] Box < tokio:: sync:: mpsc:: error:: SendError < crate :: stream:: IpStackStream > > ) ,
26+ }
27+
28+ impl From < tokio:: sync:: mpsc:: error:: SendError < crate :: stream:: IpStackStream > > for IpStackError {
29+ fn from ( e : tokio:: sync:: mpsc:: error:: SendError < crate :: stream:: IpStackStream > ) -> Self {
30+ IpStackError :: SendError ( Box :: new ( e) )
31+ }
2632}
2733
2834// Safety: All variants of IpStackError either contain no data or wrap types that are `Send`.
@@ -37,7 +43,7 @@ impl From<IpStackError> for std::io::Error {
3743 fn from ( e : IpStackError ) -> Self {
3844 match e {
3945 IpStackError :: IoError ( e) => e,
40- _ => std:: io:: Error :: new ( std :: io :: ErrorKind :: Other , e) ,
46+ _ => std:: io:: Error :: other ( e) ,
4147 }
4248 }
4349}
Original file line number Diff line number Diff line change @@ -165,8 +165,7 @@ async fn process_device_read(
165165 std:: collections:: hash_map:: Entry :: Occupied ( entry) => {
166166 let len = packet. payload . as_ref ( ) . map ( |p| p. len ( ) ) . unwrap_or ( 0 ) ;
167167 log:: trace!( "packet sent to stream: {} len {}" , network_tuple, len) ;
168- use std:: io:: { Error , ErrorKind :: Other } ;
169- entry. get ( ) . send ( packet) . map_err ( |e| Error :: new ( Other , e) ) ?;
168+ entry. get ( ) . send ( packet) . map_err ( std:: io:: Error :: other) ?;
170169 }
171170 std:: collections:: hash_map:: Entry :: Vacant ( entry) => {
172171 let ( tx, rx) = tokio:: sync:: oneshot:: channel :: < ( ) > ( ) ;
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ impl IpStackUnknownTransport {
4646 let packet = self . create_rev_packet ( & mut payload) ?;
4747 self . packet_sender
4848 . send ( packet)
49- . map_err ( |e| std:: io:: Error :: new ( std :: io :: ErrorKind :: Other , format ! ( "send error: {}" , e) ) ) ?;
49+ . map_err ( |e| std:: io:: Error :: other ( format ! ( "send error: {}" , e) ) ) ?;
5050 if payload. is_empty ( ) {
5151 return Ok ( ( ) ) ;
5252 }
You can’t perform that action at this time.
0 commit comments