summaryrefslogtreecommitdiff
path: root/qpid/python
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2013-05-29 18:03:50 +0000
committerAlan Conway <aconway@apache.org>2013-05-29 18:03:50 +0000
commitd9e90c6c43e1b81d68750ffa3cf09e3fdcf3cb13 (patch)
treeec3f8d1f590532428e0f4ce17ab31c0c84dcb681 /qpid/python
parent6b1d0c81ab29ca845923923cc502c05699a32a08 (diff)
downloadqpid-python-d9e90c6c43e1b81d68750ffa3cf09e3fdcf3cb13.tar.gz
NO-JIRA: Added connection timeout to python client, used in brokertests.
Added an optional timeout parameter to Connection.establish. Set a timeout of 5 seconds in brokertest.py to prevent hanging tests. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1487578 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/python')
-rw-r--r--qpid/python/qpid/messaging/endpoints.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/qpid/python/qpid/messaging/endpoints.py b/qpid/python/qpid/messaging/endpoints.py
index 3c9639552c..7621dceb3d 100644
--- a/qpid/python/qpid/messaging/endpoints.py
+++ b/qpid/python/qpid/messaging/endpoints.py
@@ -59,13 +59,13 @@ class Connection(Endpoint):
"""
@static
- def establish(url=None, **options):
+ def establish(url=None, timeout=None, **options):
"""
Constructs a L{Connection} with the supplied parameters and opens
it.
"""
conn = Connection(url, **options)
- conn.open()
+ conn.open(timeout=timeout)
return conn
def __init__(self, url=None, **options):
@@ -257,14 +257,13 @@ class Connection(Endpoint):
self.sessions.pop(ssn.name, 0)
@synchronized
- def open(self):
+ def open(self, timeout=None):
"""
Opens a connection.
"""
if self._open:
raise ConnectionError("already open")
self._open = True
- timeout = None
if self.reconnect and self.reconnect_timeout > 0:
timeout = self.reconnect_timeout
self.attach(timeout=timeout)