X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=python%2Fovs%2Fjsonrpc.py;h=5117944137e7ac15661c1ff4789f27c07c2c5cd3;hb=109b8459218973f7fba72fc606bcdbbb306592de;hp=1cc7fb7de9f145f5f6ac4870eacf360759f630ee;hpb=2ad4ef89208cf683859b1a269f3c5328a998c47d;p=openvswitch diff --git a/python/ovs/jsonrpc.py b/python/ovs/jsonrpc.py index 1cc7fb7d..51179441 100644 --- a/python/ovs/jsonrpc.py +++ b/python/ovs/jsonrpc.py @@ -72,8 +72,7 @@ class Message(object): def type_to_string(type_): return Message.__types[type_] - @staticmethod - def __validate_arg(value, name, must_have): + def __validate_arg(self, value, name, must_have): if (value is not None) == (must_have != 0): return None else: @@ -96,11 +95,11 @@ class Message(object): return "invalid JSON-RPC message type %s" % self.type return ( - Message.__validate_arg(self.method, "method", pattern & 0x10000) or - Message.__validate_arg(self.params, "params", pattern & 0x1000) or - Message.__validate_arg(self.result, "result", pattern & 0x100) or - Message.__validate_arg(self.error, "error", pattern & 0x10) or - Message.__validate_arg(self.id, "id", pattern & 0x1)) + self.__validate_arg(self.method, "method", pattern & 0x10000) or + self.__validate_arg(self.params, "params", pattern & 0x1000) or + self.__validate_arg(self.result, "result", pattern & 0x100) or + self.__validate_arg(self.error, "error", pattern & 0x10) or + self.__validate_arg(self.id, "id", pattern & 0x1)) @staticmethod def from_json(json): @@ -174,7 +173,7 @@ class Message(object): class Connection(object): def __init__(self, stream): - self.name = stream.get_name() + self.name = stream.name self.stream = stream self.status = 0 self.input = "" @@ -360,7 +359,7 @@ class Session(object): reconnect.enable(ovs.timeval.msec()) if ovs.stream.PassiveStream.is_valid_name(name): - self.reconnect.set_passive(True, ovs.timeval.msec()) + reconnect.set_passive(True, ovs.timeval.msec()) return Session(reconnect, None)