Skip to content

Commit 7f0c61c

Browse files
committed
Prevent panics in read_too_large_message_body test
1 parent 4715265 commit 7f0c61c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lightning-block-sync/src/http_clients.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -638,9 +638,14 @@ mod tests {
638638
if lines_read == 0 { return; }
639639

640640
for chunk in response.as_bytes().chunks(16) {
641-
stream.write(chunk).unwrap();
642-
stream.flush().unwrap();
643-
std::thread::yield_now();
641+
match stream.take_error().unwrap() {
642+
None => {
643+
stream.write(chunk).unwrap();
644+
stream.flush().unwrap();
645+
std::thread::yield_now();
646+
},
647+
Some(_) => break,
648+
}
644649
}
645650
});
646651

0 commit comments

Comments
 (0)