diff options
author | trociny <trociny@FreeBSD.org> | 2011-03-17 21:02:14 +0000 |
---|---|---|
committer | trociny <trociny@FreeBSD.org> | 2011-03-17 21:02:14 +0000 |
commit | 66e5107b571ac3e5cd2a0b66c0d805d2e6072201 (patch) | |
tree | cd8ed08209d32f881cc54fe7452a16ee305e8860 /sbin/hastd/primary.c | |
parent | 6f3e84b7408a26889c512ddf8dc7b7f623415038 (diff) | |
download | FreeBSD-src-66e5107b571ac3e5cd2a0b66c0d805d2e6072201.zip FreeBSD-src-66e5107b571ac3e5cd2a0b66c0d805d2e6072201.tar.gz |
For secondary, set 2 * HAST_KEEPALIVE seconds timeout for incoming
connection so the worker will exit if it does not receive packets from
the primary during this interval.
Reported by: Christian Vogt <Christian.Vogt@haw-hamburg.de>
Tested by: Christian Vogt <Christian.Vogt@haw-hamburg.de>
Approved by: pjd (mentor)
MFC after: 1 week
Diffstat (limited to 'sbin/hastd/primary.c')
-rw-r--r-- | sbin/hastd/primary.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/sbin/hastd/primary.c b/sbin/hastd/primary.c index 6246c71..c9266e5 100644 --- a/sbin/hastd/primary.c +++ b/sbin/hastd/primary.c @@ -150,10 +150,6 @@ static pthread_mutex_t metadata_lock; * and remote components. */ #define HAST_NCOMPONENTS 2 -/* - * Number of seconds to sleep between reconnect retries or keepalive packets. - */ -#define RETRY_SLEEP 10 #define ISCONNECTED(res, no) \ ((res)->hr_remotein != NULL && (res)->hr_remoteout != NULL) @@ -1318,10 +1314,10 @@ remote_send_thread(void *arg) for (;;) { pjdlog_debug(2, "remote_send: Taking request."); - QUEUE_TAKE1(hio, send, ncomp, RETRY_SLEEP); + QUEUE_TAKE1(hio, send, ncomp, HAST_KEEPALIVE); if (hio == NULL) { now = time(NULL); - if (lastcheck + RETRY_SLEEP <= now) { + if (lastcheck + HAST_KEEPALIVE <= now) { keepalive_send(res, ncomp); lastcheck = now; } @@ -2098,7 +2094,7 @@ guard_thread(void *arg) PJDLOG_VERIFY(sigaddset(&mask, SIGINT) == 0); PJDLOG_VERIFY(sigaddset(&mask, SIGTERM) == 0); - timeout.tv_sec = RETRY_SLEEP; + timeout.tv_sec = HAST_KEEPALIVE; timeout.tv_nsec = 0; signo = -1; @@ -2116,7 +2112,7 @@ guard_thread(void *arg) pjdlog_debug(2, "remote_guard: Checking connections."); now = time(NULL); - if (lastcheck + RETRY_SLEEP <= now) { + if (lastcheck + HAST_KEEPALIVE <= now) { for (ii = 0; ii < ncomps; ii++) guard_one(res, ii); lastcheck = now; |