diff options
author | Ethan Jackson <ethan@nicira.com> | 2012-04-11 20:18:34 -0700 |
---|---|---|
committer | Ethan Jackson <ethan@nicira.com> | 2012-04-12 00:43:22 -0700 |
commit | f1936eb65178f796d26a8d265697af8c19dce8cd (patch) | |
tree | 05616ee0958f35adcb6822354a74905a89f659b1 /python | |
parent | bceb55c8ba91af812bc61e1ebc54f367ad034157 (diff) |
stream: By default disable probing on unix sockets.
There isn't a lot of value in sending inactivity probes on unix
sockets. This patch changes the default to disable them.
Signed-off-by: Ethan Jackson <ethan@nicira.com>
Diffstat (limited to 'python')
-rw-r--r-- | python/ovs/jsonrpc.py | 3 | ||||
-rw-r--r-- | python/ovs/stream.py | 13 |
2 files changed, 16 insertions, 0 deletions
diff --git a/python/ovs/jsonrpc.py b/python/ovs/jsonrpc.py index 5f90b396..b72af77c 100644 --- a/python/ovs/jsonrpc.py +++ b/python/ovs/jsonrpc.py @@ -372,6 +372,9 @@ class Session(object): if ovs.stream.PassiveStream.is_valid_name(name): reconnect.set_passive(True, ovs.timeval.msec()) + if ovs.stream.stream_or_pstream_needs_probes(name): + reconnect.set_probe_interval(0) + return Session(reconnect, None) @staticmethod diff --git a/python/ovs/stream.py b/python/ovs/stream.py index 08c6293a..e2adaa5b 100644 --- a/python/ovs/stream.py +++ b/python/ovs/stream.py @@ -24,6 +24,19 @@ import ovs.vlog vlog = ovs.vlog.Vlog("stream") +def stream_or_pstream_needs_probes(name): + """ 1 if the stream or pstream specified by 'name' needs periodic probes to + verify connectivty. For [p]streams which need probes, it can take a long + time to notice the connection was dropped. Returns 0 if probes aren't + needed, and -1 if 'name' is invalid""" + + if PassiveStream.is_valid_name(name) or Stream.is_valid_name(name): + # Only unix and punix are supported currently. + return 0 + else: + return -1 + + class Stream(object): """Bidirectional byte stream. Currently only Unix domain sockets are implemented.""" |