INNER CODE UNIT · Python
start_server
not-sekiun/Consortium · consortium/server/server.py:299
async def start_server(self) -> None:
# Uvicorn will ordinarily warn of an already bound socket through its logger,
# but we disabled it, so we need to do our own socket check to see if the
# address is bindable.
try:
test_sock = socket.socket()
test_sock.bind(
(self.server_config.local_host, self.server_config.local_port),
)
test_sock.close()
except OSError as exc:
self._logger.error(
"Failed to start server. Network error occurred while attempting to "
"bind server to target socket address: {}. Check that no other "
"process is already using the socket address {}:{}",
exc,
self.server_config.local_host,
self.server_config.local_port,