Skip to content

Commit 03ad9fa

Browse files
committed
Fix create_connection when sock and ssl args are passed
1 parent 0047241 commit 03ad9fa

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

tests/test_tcp.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -935,6 +935,27 @@ async def client(addr):
935935

936936
writer.close()
937937

938+
async def client_sock(addr):
939+
sock = socket.socket()
940+
sock.connect(addr)
941+
reader, writer = await asyncio.open_connection(
942+
sock=sock,
943+
ssl=client_sslctx,
944+
server_hostname='',
945+
loop=self.loop)
946+
947+
writer.write(A_DATA)
948+
self.assertEqual(await reader.readexactly(2), b'OK')
949+
950+
writer.write(B_DATA)
951+
self.assertEqual(await reader.readexactly(4), b'SPAM')
952+
953+
nonlocal CNT
954+
CNT += 1
955+
956+
writer.close()
957+
sock.close()
958+
938959
def run(coro):
939960
nonlocal CNT
940961
CNT = 0
@@ -956,6 +977,9 @@ def run(coro):
956977
with self._silence_eof_received_warning():
957978
run(client)
958979

980+
with self._silence_eof_received_warning():
981+
run(client_sock)
982+
959983

960984
class Test_UV_TCPSSL(_TestSSL, tb.UVTestCase):
961985

uvloop/loop.pyx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1479,7 +1479,6 @@ cdef class Loop:
14791479
'host and port was not specified and no sock specified')
14801480

14811481
waiter = self._new_future()
1482-
protocol = protocol_factory()
14831482
tr = TCPTransport.new(self, protocol, None, waiter)
14841483
try:
14851484
# libuv will make socket non-blocking

0 commit comments

Comments
 (0)