This commit is contained in:
Victor Shyba 2022-04-05 00:35:48 -03:00
parent c830784f65
commit 79a5f0e375

View file

@ -169,11 +169,11 @@ class BlobServer:
async def _start_server():
# checking if the port is in use
# thx https://stackoverflow.com/questions/2470971/fast-way-to-test-if-a-port-is-in-use-using-python/52872579#52872579
# thx https://stackoverflow.com/a/52872579
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
if s.connect_ex(('localhost', port)) == 0:
# the port is already in use!
log.error("Failed to bind TCP {}:{}".format(interface, port))
log.error("Failed to bind TCP %s:%d", interface, port)
server = await self.loop.create_server(
lambda: self.server_protocol_class(self.loop, self.blob_manager, self.lbrycrd_address,