Skip to content

Commit c34fde5

Browse files
committed
Revert "Handle EOF in the reader thread"
This reverts commit acc05c3 which caused many failures in BDK. It was released as part of `0.10.3`, which has now been yanked from crates.io
1 parent 737cedb commit c34fde5

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/raw_client.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)