summaryrefslogtreecommitdiff
path: root/lib/reconnect.c
Commit message (Collapse)AuthorAgeFilesLines
* netdev-dummy: Fix reconnecting.Andy Zhou2014-02-121-1/+1
| | | | | | | | | | | The netdev-dummy unit test ran into the reconnect condition on Jarno's machine. With his test environment, we found and fixed the bugs in handling reconnect. Co-authored-by: Jarno Rajahalme <jrajahalme@nicira.com> Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Signed-off-by: Andy Zhou <azhou@nicira.com> Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
* Rename NOT_REACHED to OVS_NOT_REACHEDHarold Lim2013-12-171-2/+2
| | | | | | | | This allows other libraries to use util.h that has already defined NOT_REACHED. Signed-off-by: Harold Lim <haroldl@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* Replace all uses of strerror() by ovs_strerror(), for thread safety.Ben Pfaff2013-06-281-3/+3
| | | | Signed-off-by: Ben Pfaff <blp@nicira.com>
* ovs-vsctl: Try connecting only once for active connections by default.Ben Pfaff2013-03-151-2/+3
| | | | | | | | | | | | | | | | | | | | | | | Until now, ovs-vsctl has kept trying to the database server until it succeeded or the timeout expired (if one was specified with --timeout). This meant that if ovsdb-server wasn't running, then ovs-vsctl would hang. The result was that almost every ovs-vsctl invocation in scripts specified a timeout on the off-chance that the database server might not be running. But it's difficult to choose a good timeout. A timeout that is too short can cause spurious failures. A timeout that is too long causes long delays if the server really isn't running. This commit should alleviate this problem. It changes ovs-vsctl's behavior so that, if it fails to connect to the server, it exits unsuccessfully. This makes --timeout obsolete for the purpose of avoiding a hang if the database server isn't running. (--timeout is still useful to avoid a hang if ovsdb-server is running but ovs-vswitchd is not, for ovs-vsctl commands that modify the database. --no-wait also avoids that issue.) Bug #2393. Bug #15594. Reported-by: Jeff Merrick <jmerrick@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* Replace most uses of assert by ovs_assert.Ben Pfaff2013-01-161-2/+1
| | | | | | | | This is a straight search-and-replace, except that I also removed #include <assert.h> from each file where there were no assert calls left. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
* reconnect: Rename reconnect_received() to reconnect_activity().Ben Pfaff2012-09-071-16/+16
| | | | | | | | | | | | 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-18/+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>
* python: Honor zero probe interval in reconnect.pyEthan Jackson2012-04-121-1/+4
| | | | | | | | The python reconnect library attempted to send a probe every 0 milliseconds instead of disabling probing when the probe_interval was zero. Signed-off-by: Ethan Jackson <ethan@nicira.com>
* Allow configuring DSCP on controller and manager connections.Mehak Mahajan2012-03-231-0/+18
| | | | | | | | | | | 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-19/+23
| | | | | | | | | | | | 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: Rename CONNECT_IN_PROGRESS state to CONNECTING (like rconn).Andrew Evans2011-03-101-8/+8
| | | | | | reconnect uses the same connection state names as rconn with the exception of the above. This commit makes their states identical, which should reduce confusion for people debugging connection problems.
* reconnect: Track last-disconnected time.Andrew Evans2011-03-091-0/+18
| | | | | | 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-7/+11
|
* vlog: Make client supply semicolon for VLOG_DEFINE_THIS_MODULE.Ben Pfaff2010-10-291-1/+1
| | | | | It's kind of odd for VLOG_DEFINE_THIS_MODULE to supply its own semicolon, so this commit switches to the more common form.
* reconnect: Fix typo in comment.Ben Pfaff2010-08-251-1/+2
|
* vlog: Introduce VLOG_DEFINE_THIS_MODULE for declaring vlog module in use.Ben Pfaff2010-07-211-2/+2
| | | | | | | Adding a macro to define the vlog module in use adds a level of indirection, which makes it easier to change how the vlog module must be defined. A followup commit needs to do that, so getting these widespread changes out of the way first should make that commit easier to review.
* Suppress ovsdb-server log messages about connections from ovs-vsctl.Ben Pfaff2010-06-221-10/+29
| | | | | | | | | | | | | | | | 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-17/+113
| | | | | This allows the reconnect library to support clients that want to listen for an incoming connection.
* reconnect: Get rid of unused state.Ben Pfaff2010-04-121-6/+2
| | | | | Nothing ever caused the reconnect FSM to transition to the S_START_CONNECT state, so we might as well get rid of the code for it.
* reconnect: Fix repeated RECONNECT_CONNECT that was confusing JSON-RPC.Ben Pfaff2010-01-111-12/+16
| | | | | | | | | | | | | | | | | | | | reconnect_run() returns RECONNECT_CONNECT to tell the client that it should start a new connection. The client is then supposed to call reconnect_connecting() to tell the FSM that it has begun a connection attempt. However, even after reconnect_connecting() was called, reconnect_run() continued to return RECONNECT_CONNECT on each call until the connection succeeded or failed. This confused the jsonrpc_session client, which expected that it would get a 0 return value from reconnect_run() while the connection attempt was in progress. Connections that required multiple trips through the main poll loop, e.g. for SSL negotiation, would often get cut off to start a second connection attempt. This commit change reconnect_run() to return RECONNECT_CONNECT only until the client tells it that a connection is in progress, which fixes the problem. This change entails a change to the internal details of the reconnect FSM, so this commit also updates the reconnect tests to match. Reported by Jeremy Stribling.
* reconnect: Add connection attempt limiting feature.Ben Pfaff2010-01-041-3/+38
| | | | | | | 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/+523
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.