From: Ben Pfaff Date: Mon, 14 Jul 2008 20:34:14 +0000 (-0700) Subject: rconn: Time out connection attempts when the backoff deadline passes. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b0533159ba7522f8a27ce7577b5b0a486a78371d;p=openvswitch 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. --- 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) {