Skip to content

Commit

Permalink
fix(client): divide by zero error if DNS returns 0 addrs (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
gngpp authored Dec 9, 2023
1 parent 7af1744 commit 99409f5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/client/legacy/connect/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,9 @@ struct ConnectingTcpRemote {

impl ConnectingTcpRemote {
fn new(addrs: dns::SocketAddrs, connect_timeout: Option<Duration>) -> Self {
let connect_timeout = connect_timeout.map(|t| t / (addrs.len() as u32));
let connect_timeout = connect_timeout
.map(|t| t.checked_div(addrs.len() as u32))
.flatten();

Self {
addrs,
Expand Down

0 comments on commit 99409f5

Please sign in to comment.