X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=python%2Fovs%2Fjsonrpc.py;h=c1540eb78e9c59d3af53ee1856e417ce4145d1c5;hb=24f974c481bc5230552b23d96312f645f7533cd3;hp=fa66aabac18bfabd8de8dedec1e4e292780e7cb2;hpb=3a8d38c88e26f9f76f3c60efbcbead02240c26d0;p=sliver-openvswitch.git diff --git a/python/ovs/jsonrpc.py b/python/ovs/jsonrpc.py index fa66aabac..c1540eb78 100644 --- a/python/ovs/jsonrpc.py +++ b/python/ovs/jsonrpc.py @@ -449,14 +449,16 @@ class Session(object): self.pstream = None if self.rpc: - received_bytes = self.rpc.get_received_bytes() + backlog = self.rpc.get_backlog() self.rpc.run() - if received_bytes != self.rpc.get_received_bytes(): - # Data was successfully received. + if self.rpc.get_backlog() < backlog: + # Data previously caught in a queue was successfully sent (or + # there's an error, which we'll catch below). # - # Previously we only counted receiving a full message as - # activity, but with large messages or a slow connection that - # policy could time out the session mid-message. + # We don't count data that is successfully sent immediately as + # activity, because there's a lot of queuing downstream from + # us, which means that we can push a lot of data into a + # connection that has stalled and won't ever recover. self.reconnect.activity(ovs.timeval.msec()) error = self.rpc.get_status() @@ -516,16 +518,14 @@ class Session(object): def recv(self): if self.rpc is not None: - backlog = self.rpc.get_backlog() + received_bytes = self.rpc.get_received_bytes() error, msg = self.rpc.recv() - if self.rpc.get_backlog() < backlog: - # Data previously caught in a queue was successfully sent (or - # there's an error, which we'll catch below). + if received_bytes != self.rpc.get_received_bytes(): + # Data was successfully received. # - # We don't count data that is successfully sent immediately as - # activity, because there's a lot of queuing downstream from - # us, which means that we can push a lot of data into a - # connection that has stalled and won't ever recover. + # Previously we only counted receiving a full message as + # activity, but with large messages or a slow connection that + # policy could time out the session mid-message. self.reconnect.activity(ovs.timeval.msec()) if not error: