mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
merge 79422b3684f1 in 3.3 branch (issue 10340)
This commit is contained in:
commit
3539ef3d21
2 changed files with 25 additions and 8 deletions
|
@ -7,6 +7,7 @@ import sys
|
|||
import time
|
||||
import warnings
|
||||
import errno
|
||||
import struct
|
||||
|
||||
from test import support
|
||||
from test.support import TESTFN, run_unittest, unlink
|
||||
|
@ -778,6 +779,21 @@ class BaseTestAPI(unittest.TestCase):
|
|||
finally:
|
||||
sock.close()
|
||||
|
||||
@unittest.skipUnless(threading, 'Threading required for this test.')
|
||||
@support.reap_threads
|
||||
def test_quick_connect(self):
|
||||
# see: http://bugs.python.org/issue10340
|
||||
server = TCPServer()
|
||||
t = threading.Thread(target=lambda: asyncore.loop(timeout=0.1, count=500))
|
||||
t.start()
|
||||
|
||||
for x in range(20):
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
s.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER,
|
||||
struct.pack('ii', 1, 0))
|
||||
s.connect(server.address)
|
||||
s.close()
|
||||
|
||||
|
||||
class TestAPI_UseIPv4Sockets(BaseTestAPI):
|
||||
family = socket.AF_INET
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue