aboutsummaryrefslogtreecommitdiff
path: root/python/ovs
diff options
context:
space:
mode:
Diffstat (limited to 'python/ovs')
-rw-r--r--python/ovs/jsonrpc.py3
-rw-r--r--python/ovs/stream.py13
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 7ea9e46e..4264b443 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."""