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> {
477477
478478 // Loop over every message
479479 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 | {
483481 let error = Arc :: new ( e) ;
484482 for ( _, s) in self . waiting_map . lock ( ) . unwrap ( ) . drain ( ) {
485483 s. send ( ChannelMessage :: Error ( error. clone ( ) ) ) ?;
486484 }
487- return Err ( Error :: SharedIOError ( error) ) ;
488- }
489- trace ! ( "<== {:?}" , raw_resp) ;
490485
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+ _ => { }
493493 }
494494
495+ trace ! ( "<== {:?}" , raw_resp) ;
496+
495497 let resp: serde_json:: Value = serde_json:: from_str ( & raw_resp) ?;
496498
497499 // Normally there is and id, but it's missing for spontaneous notifications
You can’t perform that action at this time.
0 commit comments