mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-02 18:55:32 +00:00
http glommio: wait_for_response: panic if response sender is closed
This commit is contained in:
parent
90d560c307
commit
76bd895159
1 changed files with 36 additions and 35 deletions
|
|
@ -281,7 +281,9 @@ impl Connection {
|
|||
Err(RequestParseError::NeedMoreData) => {
|
||||
::log::debug!(
|
||||
"need more request data. current data: {:?}",
|
||||
std::str::from_utf8(&self.request_buffer[..self.request_buffer_position])
|
||||
std::str::from_utf8(
|
||||
&self.request_buffer[..self.request_buffer_position]
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -374,7 +376,12 @@ impl Connection {
|
|||
mut opt_pending_scrape_response: Option<PendingScrapeResponse>,
|
||||
) -> anyhow::Result<Response> {
|
||||
loop {
|
||||
if let Some(channel_response) = self.response_receiver.recv().await {
|
||||
let channel_response = self
|
||||
.response_receiver
|
||||
.recv()
|
||||
.await
|
||||
.expect("wait_for_response: can't receive response, sender is closed");
|
||||
|
||||
if channel_response.get_peer_addr() != self.peer_addr {
|
||||
return Err(anyhow::anyhow!("peer addresses didn't match"));
|
||||
}
|
||||
|
|
@ -404,12 +411,6 @@ impl Connection {
|
|||
}
|
||||
}
|
||||
};
|
||||
} else {
|
||||
// TODO: this is a serious error condition and should maybe be handled differently
|
||||
return Err(anyhow::anyhow!(
|
||||
"response receiver can't receive - sender is closed"
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue