server: refactor server_thread() to decouple it from handle_connection()

This commit is contained in:
Roman Zeyde
2016-10-21 21:55:27 +03:00
parent 1bd6775c35
commit 513e99dd57
2 changed files with 11 additions and 4 deletions

View File

@@ -1,3 +1,4 @@
import functools
import io
import os
import socket
@@ -78,8 +79,10 @@ def test_server_thread():
def getsockname(self): # pylint: disable=no-self-use
return 'fake_server'
handler = protocol.Handler(keys=[], signer=None),
handle_conn = functools.partial(server.handle_connection, handler=handler)
server.server_thread(sock=FakeServer(),
handler=protocol.Handler(keys=[], signer=None),
handle_conn=handle_conn,
quit_event=quit_event)