diff options
author | Martin Willi <martin@revosec.ch> | 2010-03-03 15:57:06 +0100 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2010-03-03 15:59:29 +0100 |
commit | a5a4b6c9d19e2660249452dcdc35b957ee7bf4a7 (patch) | |
tree | a953d8c5204b8406e3b91ba1d650e544de79beb6 /src/charon/network/receiver.c | |
parent | 24f058ac7420ede0de13a3d5a8a184d37e5f4a89 (diff) | |
download | strongswan-a5a4b6c9d19e2660249452dcdc35b957ee7bf4a7.tar.bz2 strongswan-a5a4b6c9d19e2660249452dcdc35b957ee7bf4a7.tar.xz |
Added charon.send/receive_delay options to simulate different RTTs
Diffstat (limited to 'src/charon/network/receiver.c')
-rw-r--r-- | src/charon/network/receiver.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/charon/network/receiver.c b/src/charon/network/receiver.c index 39d1f447a..df897021a 100644 --- a/src/charon/network/receiver.c +++ b/src/charon/network/receiver.c @@ -99,6 +99,11 @@ struct private_receiver_t { * how many half open IKE_SAs per peer before blocking */ u_int32_t block_threshold; + + /** + * Delay for receiving incoming packets, to simulate larger RTT + */ + u_int receive_delay; }; /** @@ -325,7 +330,15 @@ static job_requeue_t receive_packets(private_receiver_t *this) } } job = (job_t*)process_message_job_create(message); - charon->processor->queue_job(charon->processor, job); + if (this->receive_delay) + { + charon->scheduler->schedule_job_ms(charon->scheduler, + job, this->receive_delay); + } + else + { + charon->processor->queue_job(charon->processor, job); + } return JOB_REQUEUE_DIRECT; } @@ -359,6 +372,9 @@ receiver_t *receiver_create() this->block_threshold = lib->settings->get_int(lib->settings, "charon.block_threshold", BLOCK_THRESHOLD_DEFAULT); } + this->receive_delay = lib->settings->get_int(lib->settings, + "charon.receive_delay", 0); + this->hasher = lib->crypto->create_hasher(lib->crypto, HASH_PREFERRED); if (this->hasher == NULL) { |