Skip to content

Commit 8ca73b8

Browse files
committed
add stronger constraint over reconn_delay calculation
1 parent 2e94e79 commit 8ca73b8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/internal/sio_client_impl.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,8 @@ namespace sio
328328
unsigned client_impl::next_delay() const
329329
{
330330
//no jitter, fixed power root.
331-
return static_cast<unsigned>(min<double>(m_reconn_delay * pow(1.5,m_reconn_made),m_reconn_delay_max));
331+
unsigned reconn_made = min<unsigned>(m_reconn_made,32);//protect the pow result to be too big.
332+
return static_cast<unsigned>(min<double>(m_reconn_delay * pow(1.5,reconn_made),m_reconn_delay_max));
332333
}
333334

334335
socket::ptr client_impl::get_socket_locked(string const& nsp)

0 commit comments

Comments
 (0)