Message ID | 20170101110455.9464-1-ligs@dtdream.com |
---|---|
State | Accepted |
Headers | show |
On Sun, Jan 01, 2017 at 07:04:55PM +0800, Guoshuai Li wrote: > stream_or_pstream_needs_probes always return 0. This causes TCP/SSL > connection not be probed, and no reconnect when the connection > is aborted > > Signed-off-by: Guoshuai Li <ligs@dtdream.com> Applied to master, thanks!
On Wed, Jan 4, 2017 at 6:41 PM, Ben Pfaff <blp@ovn.org> wrote: > On Sun, Jan 01, 2017 at 07:04:55PM +0800, Guoshuai Li wrote: > > stream_or_pstream_needs_probes always return 0. This causes TCP/SSL > > connection not be probed, and no reconnect when the connection > > is aborted > > > > Signed-off-by: Guoshuai Li <ligs@dtdream.com> > > Applied to master, thanks! Are you OK with backporting this to branch-2.6? I don't mind doing it if so.
On Thu, Jan 05, 2017 at 09:58:11AM -0500, Russell Bryant wrote: > On Wed, Jan 4, 2017 at 6:41 PM, Ben Pfaff <blp@ovn.org> wrote: > > > On Sun, Jan 01, 2017 at 07:04:55PM +0800, Guoshuai Li wrote: > > > stream_or_pstream_needs_probes always return 0. This causes TCP/SSL > > > connection not be probed, and no reconnect when the connection > > > is aborted > > > > > > Signed-off-by: Guoshuai Li <ligs@dtdream.com> > > > > Applied to master, thanks! > > Are you OK with backporting this to branch-2.6? I don't mind doing it if > so. Fine with me. I considered it but at least superficially it had patch rejects and I did not look further.
> On Thu, Jan 05, 2017 at 09:58:11AM -0500, Russell Bryant wrote: >> On Wed, Jan 4, 2017 at 6:41 PM, Ben Pfaff <blp@ovn.org> wrote: >> >>> On Sun, Jan 01, 2017 at 07:04:55PM +0800, Guoshuai Li wrote: >>>> stream_or_pstream_needs_probes always return 0. This causes TCP/SSL >>>> connection not be probed, and no reconnect when the connection >>>> is aborted >>>> >>>> Signed-off-by: Guoshuai Li <ligs@dtdream.com> >>> Applied to master, thanks! >> Are you OK with backporting this to branch-2.6? I don't mind doing it if >> so. > Fine with me. I considered it but at least superficially it had patch > rejects and I did not look further. This patch conflicts with branch-2.6 because of SSLStream, so I recommit a patch: https://mail.openvswitch.org/pipermail/ovs-dev/2017-January/327237.html
diff --git a/python/ovs/stream.py b/python/ovs/stream.py index cd57eb3..e74985f 100644 --- a/python/ovs/stream.py +++ b/python/ovs/stream.py @@ -31,16 +31,18 @@ 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 connectivity. 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 + """ True if the stream or pstream specified by 'name' needs periodic probes + to verify connectivity. For [p]streams which need probes, it can take a + long time to notice the connection was dropped. Returns False if probes + aren't needed, and None if 'name' is invalid""" + + cls = Stream._find_method(name) + if cls: + return cls.needs_probes() + elif PassiveStream.is_valid_name(name): + return PassiveStream.needs_probes(name) else: - return -1 + return None class Stream(object): @@ -288,6 +290,10 @@ class Stream(object): class PassiveStream(object): @staticmethod + def needs_probes(name): + return False if name.startswith("punix:") else True + + @staticmethod def is_valid_name(name): """Returns True if 'name' is a passive stream name in the form "TYPE:ARGS" and TYPE is a supported passive stream type (currently @@ -391,6 +397,10 @@ Passive %s connection methods: class UnixStream(Stream): @staticmethod + def needs_probes(): + return False + + @staticmethod def _open(suffix, dscp): connect_path = suffix return ovs.socket_util.make_unix_socket(socket.SOCK_STREAM, @@ -402,6 +412,10 @@ Stream.register_method("unix", UnixStream) class TCPStream(Stream): @staticmethod + def needs_probes(): + return True + + @staticmethod def _open(suffix, dscp): error, sock = ovs.socket_util.inet_open_active(socket.SOCK_STREAM, suffix, 0, dscp) @@ -414,6 +428,9 @@ Stream.register_method("tcp", TCPStream) class SSLStream(Stream): + @staticmethod + def needs_probes(): + return True @staticmethod def verify_cb(conn, cert, errnum, depth, ok):
stream_or_pstream_needs_probes always return 0. This causes TCP/SSL connection not be probed, and no reconnect when the connection is aborted Signed-off-by: Guoshuai Li <ligs@dtdream.com> --- python/ovs/stream.py | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-)