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> {
485485
486486 // Loop over every message
487487 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) {
489491 let error = Arc :: new ( e) ;
490492 for ( _, s) in self . waiting_map . lock ( ) . unwrap ( ) . drain ( ) {
491493 s. send ( ChannelMessage :: Error ( error. clone ( ) ) ) ?;
492494 }
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) ) ;
501496 }
502-
503497 trace ! ( "<== {:?}" , raw_resp) ;
504498
499+ if raw_resp. is_empty ( ) {
500+ continue ;
501+ }
502+
505503 let resp: serde_json:: Value = serde_json:: from_str ( & raw_resp) ?;
506504
507505 // Normally there is and id, but it's missing for spontaneous notifications
You can’t perform that action at this time.
0 commit comments