File tree Expand file tree Collapse file tree 1 file changed +27
-7
lines changed Expand file tree Collapse file tree 1 file changed +27
-7
lines changed Original file line number Diff line number Diff line change @@ -63,17 +63,11 @@ async def start_server():
63
63
# (asyncio doesn't support multiple hosts in 3.5.0)
64
64
addrs = '127.0.0.1'
65
65
66
- extra = {}
67
- if hasattr (socket , 'SO_REUSEPORT' ) and \
68
- sys .version_info [:3 ] >= (3 , 5 , 1 ):
69
- extra ['reuse_port' ] = True
70
-
71
66
srv = await asyncio .start_server (
72
67
handle_client ,
73
68
addrs , 0 ,
74
69
family = socket .AF_INET ,
75
- loop = self .loop ,
76
- ** extra )
70
+ loop = self .loop )
77
71
78
72
srv_socks = srv .sockets
79
73
self .assertTrue (srv_socks )
@@ -192,6 +186,32 @@ async def runner():
192
186
193
187
self .loop .run_until_complete (runner ())
194
188
189
+ def test_create_server_6 (self ):
190
+ if not hasattr (socket , 'SO_REUSEPORT' ):
191
+ return unittest .skip ('The system does not support SO_REUSEPORT' )
192
+
193
+ if sys .version_info [:3 ] < (3 , 5 , 1 ):
194
+ return unittest .skip ('asyncio in CPython 3.5.0 does not have the '
195
+ 'reuse_port argument' )
196
+
197
+ port = tb .find_free_port ()
198
+
199
+ async def runner ():
200
+ srv1 = await self .loop .create_server (
201
+ asyncio .Protocol ,
202
+ None , port ,
203
+ reuse_port = True )
204
+
205
+ srv2 = await self .loop .create_server (
206
+ asyncio .Protocol ,
207
+ None , port ,
208
+ reuse_port = True )
209
+
210
+ srv1 .close ()
211
+ srv2 .close ()
212
+
213
+ self .loop .run_until_complete (runner ())
214
+
195
215
def test_create_connection_1 (self ):
196
216
CNT = 0
197
217
TOTAL_CNT = 100
You can’t perform that action at this time.
0 commit comments