X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=python%2Fovs%2Fstream.py;h=dad68483e7a8ea72735397a470be85e972f22a6b;hb=1804d25a21dcdec83437ab1ebf9daf683d7e50da;hp=8cc820282550c5c167d4ecbdbfe3dd555790c98b;hpb=e06d06a7b3386cd7a60fae1b77ae0acedf42c3e3;p=openvswitch diff --git a/python/ovs/stream.py b/python/ovs/stream.py index 8cc82028..dad68483 100644 --- a/python/ovs/stream.py +++ b/python/ovs/stream.py @@ -54,11 +54,8 @@ class Stream(object): _SOCKET_METHODS = {} @staticmethod - def register_method(method): - def _register_method(cls): - Stream._SOCKET_METHODS[method + ":"] = cls - return cls - return _register_method + def register_method(method, cls): + Stream._SOCKET_METHODS[method + ":"] = cls @staticmethod def _find_method(name): @@ -344,16 +341,15 @@ Passive %s connection methods: punix:FILE Listen on Unix domain socket FILE""" % (name, name) -@Stream.register_method("unix") class UnixStream(Stream): @staticmethod def _open(suffix, dscp): connect_path = suffix return ovs.socket_util.make_unix_socket(socket.SOCK_STREAM, True, None, connect_path) +Stream.register_method("unix", UnixStream) -@Stream.register_method("tcp") class TCPStream(Stream): @staticmethod def _open(suffix, dscp): @@ -362,3 +358,4 @@ class TCPStream(Stream): if not error: sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) return error, sock +Stream.register_method("tcp", TCPStream)