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