chiark / gitweb /
site setup: move st->key_renegotiate_time default calculation nearer use
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 12 Jun 2011 18:11:45 +0000 (19:11 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 26 Jun 2011 11:07:27 +0000 (12:07 +0100)
st->key_renegotiate_time is first calculated as a default and then
that value ought to be used as a default for the config lookup.  So
move the default calculation near where the config lookup takes place
to keep the related code together.

Pure code motion; no functional change.  Also, the value computed is
not currently used due to a bug which will be fixed in the next patch.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
site.c

diff --git a/site.c b/site.c
index 835ccc8..b780815 100644 (file)
--- a/site.c
+++ b/site.c
@@ -1238,16 +1238,17 @@ static list_t *site_apply(closure_t *self, struct cloc loc, dict_t *context,
 
     st->key_lifetime=dict_read_number(
        dict,"key-lifetime",False,"site",loc,DEFAULT_KEY_LIFETIME);
-    if (st->key_lifetime < DEFAULT_KEY_RENEGOTIATE_GAP*2)
-       st->key_renegotiate_time=st->key_lifetime/2;
-    else
-       st->key_renegotiate_time=st->key_lifetime-DEFAULT_KEY_RENEGOTIATE_GAP;
     st->setup_retries=dict_read_number(
        dict,"setup-retries",False,"site",loc,DEFAULT_SETUP_RETRIES);
     st->setup_timeout=dict_read_number(
        dict,"setup-timeout",False,"site",loc,DEFAULT_SETUP_TIMEOUT);
     st->wait_timeout=dict_read_number(
        dict,"wait-time",False,"site",loc,DEFAULT_WAIT_TIME);
+
+    if (st->key_lifetime < DEFAULT_KEY_RENEGOTIATE_GAP*2)
+       st->key_renegotiate_time=st->key_lifetime/2;
+    else
+       st->key_renegotiate_time=st->key_lifetime-DEFAULT_KEY_RENEGOTIATE_GAP;
     st->key_renegotiate_time=dict_read_number(
        dict,"renegotiate-time",False,"site",loc,st->key_lifetime);
     if (st->key_renegotiate_time > st->key_lifetime) {