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 {
74
74
75
75
let ( tx, mut rx) : ( ResultSender , ResultReceiver ) = mpsc:: channel ( 100 ) ;
76
76
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) ;
79
81
80
82
self . req_tx
81
83
. send ( msg)
@@ -136,8 +138,11 @@ impl Client {
136
138
}
137
139
138
140
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
+
141
146
self . req_tx
142
147
. send ( msg)
143
148
. await
You can’t perform that action at this time.
0 commit comments