Better random reconnect time

This commit is contained in:
Tobias Blomberg 2019-10-03 21:31:18 +02:00
parent 01ce4a72dd
commit 4721815b8e
1 changed files with 1 additions and 1 deletions

View File

@ -445,7 +445,7 @@ void ReflectorLogic::onDisconnected(TcpConnection *con,
cout << name() << ": Disconnected from " << m_con->remoteHost() << ":"
<< m_con->remotePort() << ": "
<< TcpConnection::disconnectReasonStr(reason) << endl;
m_reconnect_timer.setTimeout(1000 + 5000 * std::rand() / RAND_MAX);
m_reconnect_timer.setTimeout(1000 + std::rand() % 5000);
m_reconnect_timer.setEnable(true);
delete m_udp_sock;
m_udp_sock = 0;