Skip to content

Commit

Permalink
Revert min / max change and set timeout_t nice way
Browse files Browse the repository at this point in the history
Mixing up seconds and micro-seconds made me do it.
  • Loading branch information
tqh committed Mar 25, 2017
1 parent 3bbff30 commit f136149
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/servers/net/DHCPClient.cpp
Expand Up @@ -157,7 +157,7 @@ struct dhcp_message {
struct socket_timeout {
socket_timeout(int socket)
:
timeout((time_t)AS_USECS(DEFAULT_TIMEOUT)),
timeout(time_t(AS_USECS(DEFAULT_TIMEOUT))),
tries(0)
{
UpdateSocket(socket);
Expand Down Expand Up @@ -457,7 +457,7 @@ socket_timeout::Shift(int socket, bigtime_t stateMaxTime, const char* device)
if (stateMaxTime == -1)
return false;
bigtime_t remaining = (stateMaxTime - system_time()) / 2 + 1;
timeout = std::min(remaining, (bigtime_t)AS_USECS(MAX_TIMEOUT));
timeout = std::max(remaining, bigtime_t(60));
}

syslog(LOG_DEBUG, "%s: Timeout shift: %lu secs (try %lu)\n",
Expand Down

0 comments on commit f136149

Please sign in to comment.