-# Copyright (c) 2010, 2011 Nicira Networks
+# Copyright (c) 2010, 2011, 2012 Nicira, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
import ovs.reconnect
import ovs.stream
import ovs.timeval
+import ovs.util
import ovs.vlog
-EOF = -1
+EOF = ovs.util.EOF
vlog = ovs.vlog.Vlog("jsonrpc")
if not self.status:
self.stream.run_wait(poller)
if len(self.output):
- self.stream.send_wait()
+ self.stream.send_wait(poller)
def get_status(self):
return self.status
reply = None
while not error:
error, reply = self.recv_block()
- if reply and reply.type == Message.T_REPLY and reply.id == id_:
+ if (reply
+ and (reply.type == Message.T_REPLY
+ or reply.type == Message.T_ERROR)
+ and reply.id == id_):
break
return error, reply
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