Add idle-time-out support

This commit is contained in:
Kenneth Giusti 2014-02-03 11:55:27 -05:00
parent a8d5be95ce
commit 9300a3732f
3 changed files with 10 additions and 3 deletions

@ -339,7 +339,7 @@ def main(argv=None):
container = fusion.Container(uuid.uuid4().hex)
conn_properties = {}
if opts.trace:
conn_properties["trace"] = True
conn_properties["x-trace-protocol"] = True
my_connection = MyConnection( "to-server", container, conn_properties)

@ -299,6 +299,8 @@ def main(argv=None):
default="amqp://0.0.0.0:5672",
help="""The socket address this server will listen on
[amqp://0.0.0.0:5672]""")
parser.add_option("--idle", dest="idle_timeout", type="float",
help="timeout for an idle link, in seconds")
parser.add_option("--trace", dest="trace", action="store_true",
help="enable protocol tracing")
parser.add_option("--debug", dest="debug", action="store_true",
@ -373,8 +375,10 @@ def main(argv=None):
name = uuid.uuid4().hex
assert name not in socket_connections
conn_properties = {}
if opts.idle_timeout:
conn_properties["idle-time-out"] = opts.idle_timeout
if opts.trace:
conn_properties["trace"] = True
conn_properties["x-trace-protocol"] = True
socket_connections[name] = SocketConnection(name,
client_socket,
container,

@ -82,7 +82,10 @@ class Connection(object):
self._pn_transport = proton.Transport()
self._pn_transport.bind(self._pn_connection)
if properties.get("trace"):
secs = properties.get("idle-time-out")
if secs:
self._pn_transport.idle_timeout = secs
if properties.get("x-trace-protocol"):
self._pn_transport.trace(proton.Transport.TRACE_FRM)
# indexed by link-name