debug and logging improvements

This commit is contained in:
Martin Willi
2006-06-13 10:01:04 +00:00
parent 22ff6f578f
commit fa32cd3c47
8 changed files with 43 additions and 16 deletions
+3 -3
View File
@@ -30,7 +30,7 @@
* First retransmit timeout in milliseconds.
* Timeout value is increasing in each retransmit round.
*/
#define RETRANSMIT_TIMEOUT 3000
#define RETRANSMIT_TIMEOUT 2500
/**
* Timeout in milliseconds after that a half open IKE_SA gets deleted.
@@ -42,7 +42,7 @@
* 0 for infinite. The max time a half open IKE_SA is alive is set by
* RETRANSMIT_TIMEOUT.
*/
#define MAX_RETRANSMIT_COUNT 0
#define MAX_RETRANSMIT_COUNT 3
typedef struct private_configuration_t private_configuration_t;
@@ -65,7 +65,7 @@ struct private_configuration_t {
static status_t get_retransmit_timeout (private_configuration_t *this, u_int32_t retransmit_count, u_int32_t *timeout)
{
int new_timeout = RETRANSMIT_TIMEOUT, i;
if (retransmit_count > MAX_RETRANSMIT_COUNT && MAX_RETRANSMIT_COUNT != 0)
if (retransmit_count >= MAX_RETRANSMIT_COUNT && MAX_RETRANSMIT_COUNT != 0)
{
return FAILED;
}
+2 -2
View File
@@ -40,10 +40,10 @@ struct configuration_t {
/**
* @brief Returns the retransmit timeout.
*
*
* The timeout values are managed by the configuration, so
* another backoff algorithm may be implemented here.
*
*
* @param this calling object
* @param retransmit_count number of times a message was retransmitted so far
* @param[out] timeout the new retransmit timeout in milliseconds
+4
View File
@@ -332,6 +332,10 @@ static void add_proposal(private_policy_t *this, proposal_t *proposal)
*/
static u_int32_t get_soft_lifetime(private_policy_t *this)
{
if (this->jitter == 0)
{
return this->soft_lifetime ;
}
srandom(time(NULL)+getpid());
return this->soft_lifetime - (random() % this->jitter);
}