File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -477,21 +477,23 @@ impl<S: Read + Write> RawClient<S> {
477
477
478
478
// Loop over every message
479
479
loop {
480
- raw_resp. clear ( ) ;
481
-
482
- if let Err ( e) = reader. read_line ( & mut raw_resp) {
480
+ let send_err = |e : std:: io:: Error | {
483
481
let error = Arc :: new ( e) ;
484
482
for ( _, s) in self . waiting_map . lock ( ) . unwrap ( ) . drain ( ) {
485
483
s. send ( ChannelMessage :: Error ( error. clone ( ) ) ) ?;
486
484
}
487
- return Err ( Error :: SharedIOError ( error) ) ;
488
- }
489
- trace ! ( "<== {:?}" , raw_resp) ;
490
485
491
- if raw_resp. is_empty ( ) {
492
- continue ;
486
+ Err ( Error :: SharedIOError ( error) )
487
+ } ;
488
+
489
+ match reader. read_line ( & mut raw_resp) {
490
+ Err ( e) => return send_err ( e) ,
491
+ Ok ( 0 ) => return send_err ( std:: io:: ErrorKind :: UnexpectedEof . into ( ) ) ,
492
+ _ => { }
493
493
}
494
494
495
+ trace ! ( "<== {:?}" , raw_resp) ;
496
+
495
497
let resp: serde_json:: Value = serde_json:: from_str ( & raw_resp) ?;
496
498
497
499
// Normally there is and id, but it's missing for spontaneous notifications
You can’t perform that action at this time.
0 commit comments