diff options
author | Charles-François Natali <neologix@free.fr> | 2011-10-29 10:45:56 (GMT) |
---|---|---|
committer | Charles-François Natali <neologix@free.fr> | 2011-10-29 10:45:56 (GMT) |
commit | d4621190c9206cb01a1ca03d1cc8ae0d7e9f90d9 (patch) | |
tree | 67b6f32b87d9aaee0f7cd1061261b79c66409832 /Lib/test/test_asyncore.py | |
parent | 39be3834069fe35782e852fdd845d55ff39ad345 (diff) | |
download | cpython-d4621190c9206cb01a1ca03d1cc8ae0d7e9f90d9.zip cpython-d4621190c9206cb01a1ca03d1cc8ae0d7e9f90d9.tar.gz cpython-d4621190c9206cb01a1ca03d1cc8ae0d7e9f90d9.tar.bz2 |
Issue #5661: Add a test for ECONNRESET/EPIPE handling to test_asyncore. Patch
by Xavier de Gaye.
Diffstat (limited to 'Lib/test/test_asyncore.py')
-rw-r--r-- | Lib/test/test_asyncore.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Lib/test/test_asyncore.py b/Lib/test/test_asyncore.py index 2c84a27..7bb594d 100644 --- a/Lib/test/test_asyncore.py +++ b/Lib/test/test_asyncore.py @@ -632,6 +632,34 @@ class BaseTestAPI(unittest.TestCase): client = TestClient(self.family, server.address) self.loop_waiting_for_flag(client) + def test_handle_close_after_conn_broken(self): + # Check that ECONNRESET/EPIPE is correctly handled (issues #5661 and + # #11265). + + data = b'\0' * 128 + + class TestClient(BaseClient): + + def handle_write(self): + self.send(data) + + def handle_close(self): + self.flag = True + self.close() + + class TestHandler(BaseTestHandler): + + def handle_read(self): + self.recv(len(data)) + self.close() + + def writable(self): + return False + + server = BaseServer(self.family, self.addr, TestHandler) + client = TestClient(self.family, server.address) + self.loop_waiting_for_flag(client) + @unittest.skipIf(sys.platform.startswith("sunos"), "OOB support is broken on Solaris") def test_handle_expt(self): |