Skip to content

Commit

Permalink
Fix TCPServer being bound before allow_reuse_address is set (#711)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmwalters authored and ccordoba12 committed Dec 24, 2019
1 parent b862add commit 914d4e1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pyls/python_ls.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,12 @@ def shutdown_server(*args):
'SHUTDOWN_CALL': shutdown_server}
)

server = socketserver.TCPServer((bind_addr, port), wrapper_class)
server = socketserver.TCPServer((bind_addr, port), wrapper_class, bind_and_activate=False)
server.allow_reuse_address = True

try:
server.server_bind()
server.server_activate()
log.info('Serving %s on (%s, %s)', handler_class.__name__, bind_addr, port)
server.serve_forever()
finally:
Expand Down

0 comments on commit 914d4e1

Please sign in to comment.