summaryrefslogtreecommitdiff
path: root/lib/reconnect.h
Commit message (Collapse)AuthorAgeFilesLines
* jsonrpc: Avoid disconnecting prematurely due to long poll intervals.Ben Pfaff2020-12-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Open vSwitch has a few different jsonrpc-based protocols that depend on jsonrpc_session to make sure that the connection is up and working. In turn, jsonrpc_session uses the "reconnect" state machine to send probes if nothing is received. This works fine in normal circumstances. In unusual circumstances, though, it can happen that the program is busy and doesn't even try to receive anything for a long time. Then the timer can time out without a good reason; if it had tried to receive something, it would have. There's a solution that the clients of jsonrpc_session could adopt. Instead of first calling jsonrpc_session_run(), which is what calls into "reconnect" to deal with timing out, and then calling into jsonrpc_session_recv(), which is what tries to receive something, they could use the opposite order. That would make sure that the timeout was always based on a recent attempt to receive something. Great. The actual code in OVS that uses jsonrpc_session, though, tends to use the opposite order, and there are enough users and this is a subtle enough issue that it could get flipped back around even if we fixed it now. So this commit takes a different approach. Instead of fixing this in the users of jsonrpc_session, we fix it in the users of reconnect: make them tell when they've tried to receive something (or disable this particular feature). This commit fixes the problem that way. It's kind of hard to reproduce but I'm pretty sure that I've seen it a number of times in testing. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Ilya Maximets <i.maximets@ovn.org>
* reconnect: Add ability to do a number of retries without backoff.Ben Pfaff2018-03-241-0/+3
| | | | | | | | | | | This is aimed at an upcoming database clustering implementation, where it's desirable to try all of the cluster members quickly before backing off to retry them again in sequence. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Russell Bryant <russell@ovn.org> Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Justin Pettit <jpettit@ovn.org>
* reconnect: Rename reconnect_received() to reconnect_activity().Ben Pfaff2012-09-071-3/+3
| | | | | | | | | | | | Receiving data is not the only reasonable way to verify that a connection is up. For example, on a TCP connection, receiving an acknowledgment that the remote side has accepted data that we sent is also a reasonable means. Therefore, this commit generalizes the naming. Also, similarly for the Python implementation: Reconnect.received() becomes Reconnect.activity(). Signed-off-by: Ben Pfaff <blp@nicira.com>
* Global replace of Nicira Networks.Raju Subramanian2012-05-021-1/+1
| | | | | | | | Replaced all instances of Nicira Networks(, Inc) to Nicira, Inc. Feature #10593 Signed-off-by: Raju Subramanian <rsubramanian@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* lib: Pull dscp bits out of reconnect.Ethan Jackson2012-04-171-3/+0
| | | | | | | | The DSCP bits of a connection have nothing to do with the reconnection state machine. This pulls them up into jsonrpc which needs them to properly establish connections. Signed-off-by: Ethan Jackson <ethan@nicira.com>
* Allow configuring DSCP on controller and manager connections.Mehak Mahajan2012-03-231-0/+3
| | | | | | | | | | | The changes allow the user to specify a separate dscp value for the controller connection and the manager connection. The value will take effect on resetting the connections. If no value is specified a default value of 192 is chosen for each of the connections. Feature #10074 Requested-by: Rajiv Ramanathan <rramanathan@nicira.com> Signed-off-by: Mehak Mahajan <mmahajan@nicira.com>
* ovsdb-server: Report time since last connect and disconnect for each manager.Andrew Evans2011-03-141-13/+13
| | | | | | | | | | | | Only the time connected (if connected) or disconnected (if disconnected) is currently reported for each manager. Change to reporting both in seconds since the last connect and disconnect events respectively. An empty value indicates no previous connection or disconnection. This can help diagnose certain connectivity problems, e.g. flapping. Requested-by: Peter Balland <peter@nicira.com> Bug #4833.
* reconnect: Track last-disconnected time.Andrew Evans2011-03-091-0/+4
| | | | | | Commit a4613b01ab (ovsdb: Change the way connection duration time is reported in Manager table.), pushed earlier today, requires this commit, so OVSDB has been unbuildable from then to now.
* reconnect: Use macros instead of literals for default timeouts.Ben Pfaff2010-11-051-0/+5
|
* Suppress ovsdb-server log messages about connections from ovs-vsctl.Ben Pfaff2010-06-221-0/+2
| | | | | | | | | | | | | | | | In the ovsdb-server log there are fairly continuous messages like these: Apr 26 11:27:55|15254|reconnect|INFO|unix:/tmp/stream-unix.31734.0: connected Apr 26 11:27:55|15255|reconnect|INFO|unix:/tmp/stream-unix.31734.0: connection dropped Apr 26 11:28:00|15256|reconnect|INFO|unix:/tmp/stream-unix.31810.0: connecting... Apr 26 11:28:00|15257|reconnect|INFO|unix:/tmp/stream-unix.31810.0: connected Apr 26 11:28:00|15258|reconnect|INFO|unix:/tmp/stream-unix.31810.0: connection dropped These just indicate that ovs-vsctl is connecting to ovsdb-server from, for example, the "vif" script. But there's no need to log all that detail; it's simply not useful. This commit suppresses it. Bug #2715.
* reconnect: Implement "passive mode".Ben Pfaff2010-04-121-1/+7
| | | | | This allows the reconnect library to support clients that want to listen for an incoming connection.
* reconnect: Add connection attempt limiting feature.Ben Pfaff2010-01-041-0/+3
| | | | | | | Sometimes it is useful to limit the number of connection attempts, either from policy or because it is not possible to reconnect at all (e.g. because a connection was accepted from a listening socket instead of made with connect()). This commit adds that feature.
* New "reconnect" library for managing network connection attempts.Ben Pfaff2009-11-121-0/+99
This library implements the reconnection FSM used by the "rconn" library. Therefore, it makes sense to change rconn to use this, and I have a patch to do that, but I am not applying it at the moment to avoid changing unrelated code on the "db" branch.