aboutsummaryrefslogtreecommitdiff
path: root/src/or/config.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2002-10-01 23:37:31 +0000
committerRoger Dingledine <arma@torproject.org>2002-10-01 23:37:31 +0000
commit7ed6c8bd39d52b1adf3757aab81326bf77a68538 (patch)
tree169eb31dda26761c3ddd5590eb6647551b31422a /src/or/config.c
parent293e049a89867cc8a066fec6f9c2abce4aafa5b3 (diff)
downloadtor-7ed6c8bd39d52b1adf3757aab81326bf77a68538.tar
tor-7ed6c8bd39d52b1adf3757aab81326bf77a68538.tar.gz
introduced a periodic keepalive padding cell
now tor can be run safely inside nat'ed areas that kill idle connections; and the proxy can handle when you suspend your laptop and then emerge hours later from a new domain. svn:r125
Diffstat (limited to 'src/or/config.c')
-rw-r--r--src/or/config.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/or/config.c b/src/or/config.c
index 8bcb5bea1..af0fab8a6 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -99,6 +99,8 @@ RETURN VALUE: 0 on success, non-zero on error
0, "how many seconds between directory rebuilds", "<rebuildperiod>" },
{ "DirFetchPeriod", 'F', POPT_ARG_INT, &options->DirFetchPeriod,
0, "how many seconds between directory fetches", "<fetchperiod>" },
+ { "KeepalivePeriod", 'K', POPT_ARG_INT, &options->KeepalivePeriod,
+ 0, "how many seconds between keepalives", "<keepaliveperiod>" },
// { "ReconnectPeriod", 'e', POPT_ARG_INT, &options->ReconnectPeriod,
// 0, "how many seconds between retrying all OR connections", "<reconnectperiod>" },
{ "Role", 'R', POPT_ARG_INT, &options->Role,
@@ -122,6 +124,7 @@ RETURN VALUE: 0 on success, non-zero on error
options->LinkPadding = 0;
options->DirRebuildPeriod = 600;
options->DirFetchPeriod = 6000;
+ options->KeepalivePeriod = 300;
// options->ReconnectPeriod = 6001;
options->Role = ROLE_OR_LISTEN | ROLE_OR_CONNECT_ALL | ROLE_OP_LISTEN | ROLE_AP_LISTEN;
@@ -170,9 +173,10 @@ RETURN VALUE: 0 on success, non-zero on error
options->MaxConn,
options->TrafficShaping,
options->LinkPadding);
- printf("DirRebuildPeriod=%d, DirFetchPeriod=%d\n",
+ printf("DirRebuildPeriod=%d, DirFetchPeriod=%d KeepalivePeriod=%d\n",
options->DirRebuildPeriod,
- options->DirFetchPeriod);
+ options->DirFetchPeriod,
+ options->KeepalivePeriod);
}
/* Validate options */
@@ -287,6 +291,12 @@ RETURN VALUE: 0 on success, non-zero on error
code = -1;
}
+ if ( options->KeepalivePeriod < 1)
+ {
+ log(LOG_ERR,"KeepalivePeriod option must be positive.");
+ code = -1;
+ }
+
return code;
}