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 @@ -76,8 +76,10 @@ impl Client {
7676
7777 let ( tx, mut rx) : ( ResultSender , ResultReceiver ) = mpsc:: channel ( 100 ) ;
7878
79- // TODO: check return.
80- self . streams . lock ( ) . unwrap ( ) . insert ( stream_id, tx) ;
79+ self . streams
80+ . lock ( )
81+ . map_err ( |_| Error :: Others ( "Failed to acquire lock on streams" . to_string ( ) ) ) ?
82+ . insert ( stream_id, tx) ;
8183
8284 self . req_tx
8385 . send ( SendingMessage :: new ( msg) )
@@ -138,8 +140,11 @@ impl Client {
138140 }
139141
140142 let ( tx, rx) : ( ResultSender , ResultReceiver ) = mpsc:: channel ( 100 ) ;
141- // TODO: check return
142- self . streams . lock ( ) . unwrap ( ) . insert ( stream_id, tx) ;
143+ self . streams
144+ . lock ( )
145+ . map_err ( |_| Error :: Others ( "Failed to acquire lock on streams" . to_string ( ) ) ) ?
146+ . insert ( stream_id, tx) ;
147+
143148 self . req_tx
144149 . send ( SendingMessage :: new ( msg) )
145150 . await
You can’t perform that action at this time.
0 commit comments