diff options
author | Rafael H. Schloming <rhs@apache.org> | 2008-11-10 15:41:42 +0000 |
---|---|---|
committer | Rafael H. Schloming <rhs@apache.org> | 2008-11-10 15:41:42 +0000 |
commit | ced8b34442a004fc76a268754d4d23854c7c0af3 (patch) | |
tree | b2b86d4645680dd3eedaf19bd15473d5f6fdd129 | |
parent | 67d0d5457591f51a5e9f80bfd4874c2ff6745a89 (diff) | |
download | qpid-python-ced8b34442a004fc76a268754d4d23854c7c0af3.tar.gz |
fixed potential race condition in qpid.util.listen; added asserts to internal test cases to ensure that the test only proceeds when the server is bound
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@712679 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/python/qpid/util.py | 2 | ||||
-rw-r--r-- | qpid/python/tests/assembler.py | 1 | ||||
-rw-r--r-- | qpid/python/tests/connection.py | 1 | ||||
-rw-r--r-- | qpid/python/tests/framer.py | 1 |
4 files changed, 4 insertions, 1 deletions
diff --git a/qpid/python/qpid/util.py b/qpid/python/qpid/util.py index 1ca616f1f5..bb7f5090df 100644 --- a/qpid/python/qpid/util.py +++ b/qpid/python/qpid/util.py @@ -34,8 +34,8 @@ def listen(host, port, predicate = lambda: True, bound = lambda: None): sock = socket.socket() sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) sock.bind((host, port)) - bound() sock.listen(5) + bound() while predicate(): s, a = sock.accept() yield s diff --git a/qpid/python/tests/assembler.py b/qpid/python/tests/assembler.py index b76924e59d..f4e37084b6 100644 --- a/qpid/python/tests/assembler.py +++ b/qpid/python/tests/assembler.py @@ -47,6 +47,7 @@ class AssemblerTest(TestCase): self.server.start() started.wait(3) + assert started.isSet() def tearDown(self): self.running = False diff --git a/qpid/python/tests/connection.py b/qpid/python/tests/connection.py index 23e0c937fb..512fa62189 100644 --- a/qpid/python/tests/connection.py +++ b/qpid/python/tests/connection.py @@ -87,6 +87,7 @@ class ConnectionTest(TestCase): self.server.start() started.wait(3) + assert started.isSet() def tearDown(self): self.running = False diff --git a/qpid/python/tests/framer.py b/qpid/python/tests/framer.py index 05bb467bbe..e99166721c 100644 --- a/qpid/python/tests/framer.py +++ b/qpid/python/tests/framer.py @@ -46,6 +46,7 @@ class FramerTest(TestCase): self.server.start() started.wait(3) + assert started.isSet() def tearDown(self): self.running = False |