Made message retransmission delay +1/-1 randomized as required per RFC2131

spec (see paragraph 4.1)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41273 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Philippe Houdoin 2011-04-22 20:45:34 +00:00
parent eb32094b24
commit d09c1f8e8d

View File

@ -20,6 +20,7 @@
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <syslog.h>
#include <sys/sockio.h>
#include <sys/time.h>
@ -838,7 +839,7 @@ DHCPClient::_ResetTimeout(int socket, time_t& timeout, uint32& tries)
struct timeval value;
value.tv_sec = timeout;
value.tv_usec = 0;
value.tv_usec = rand() % 1000000;
setsockopt(socket, SOL_SOCKET, SO_RCVTIMEO, &value, sizeof(value));
}
@ -858,7 +859,7 @@ DHCPClient::_TimeoutShift(int socket, time_t& timeout, uint32& tries)
struct timeval value;
value.tv_sec = timeout;
value.tv_usec = 0;
value.tv_usec = rand() % 1000000;
setsockopt(socket, SOL_SOCKET, SO_RCVTIMEO, &value, sizeof(value));
return true;