File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -74,8 +74,10 @@ impl Client {
7474
7575 let ( tx, mut rx) : ( ResultSender , ResultReceiver ) = mpsc:: channel ( 100 ) ;
7676
77- // TODO: check return.
78- self . streams . lock ( ) . unwrap ( ) . insert ( stream_id, tx) ;
77+ self . streams
78+ . lock ( )
79+ . map_err ( |_| Error :: Others ( "Failed to acquire lock on streams" . to_string ( ) ) ) ?
80+ . insert ( stream_id, tx) ;
7981
8082 self . req_tx
8183 . send ( msg)
@@ -136,8 +138,11 @@ impl Client {
136138 }
137139
138140 let ( tx, rx) : ( ResultSender , ResultReceiver ) = mpsc:: channel ( 100 ) ;
139- // TODO: check return
140- self . streams . lock ( ) . unwrap ( ) . insert ( stream_id, tx) ;
141+ self . streams
142+ . lock ( )
143+ . map_err ( |_| Error :: Others ( "Failed to acquire lock on streams" . to_string ( ) ) ) ?
144+ . insert ( stream_id, tx) ;
145+
141146 self . req_tx
142147 . send ( msg)
143148 . await
You can’t perform that action at this time.
0 commit comments