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 {
76
76
77
77
let ( tx, mut rx) : ( ResultSender , ResultReceiver ) = mpsc:: channel ( 100 ) ;
78
78
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) ;
81
83
82
84
self . req_tx
83
85
. send ( SendingMessage :: new ( msg) )
@@ -138,8 +140,11 @@ impl Client {
138
140
}
139
141
140
142
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
+
143
148
self . req_tx
144
149
. send ( SendingMessage :: new ( msg) )
145
150
. await
You can’t perform that action at this time.
0 commit comments