Skip to content

Commit

Permalink
Trying to ensure socket used for port detection is closed before star…
Browse files Browse the repository at this point in the history
…ting the HTTP thumbnail sever.
  • Loading branch information
jonoomph committed Jan 3, 2020
1 parent ef4e8c4 commit ec3f7b1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/classes/thumbnail.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,13 @@ def find_free_port(self):
"""Find the first available socket port"""
s = socket.socket()
s.bind(('', 0))
return s.getsockname()[1]
socket_port = s.getsockname()[1]
s.close()
return socket_port

def kill(self):
self.running = False
log.info('Shutting down thumbnail server: %s' % str(self.server_address))
self.thumbServer.shutdown()

def run(self):
Expand Down

0 comments on commit ec3f7b1

Please sign in to comment.