From b0533159ba7522f8a27ce7577b5b0a486a78371d Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Mon, 14 Jul 2008 13:34:14 -0700 Subject: [PATCH] rconn: Time out connection attempts when the backoff deadline passes. Otherwise, the TCP/IP implementation is responsible for connection attempt backoff, but we want to have some control over it ourselves. In particular we want to initially back off faster and to log a message upon connection attempt retransmission, to make it easier to see what has happened from the log. --- lib/rconn.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/rconn.c b/lib/rconn.c index db21b6c5..066a5466 100644 --- a/lib/rconn.c +++ b/lib/rconn.c @@ -39,6 +39,7 @@ #include "buffer.h" #include "poll-loop.h" #include "ofp-print.h" +#include "timeval.h" #include "util.h" #include "vconn.h" @@ -155,6 +156,10 @@ rconn_run(struct rconn *rc) } else if (error != EAGAIN) { VLOG_WARN("%s: connection failed (%s)", rc->name, strerror(error)); disconnect(rc, 0); + } else if (time(0) >= rc->backoff_deadline) { + VLOG_WARN("%s: connection timed out", rc->name); + rc->backoff_deadline = TIME_MAX; /* Prevent resetting backoff. */ + disconnect(rc, 0); } } else { if (rc->probe_interval) { -- 2.30.2