mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Get the IP addresses again when restarting the smartdevice driver.
This commit is contained in:
parent
82550e6ace
commit
6914cdec13
@ -71,6 +71,8 @@ class ConnectionListener (Thread):
|
||||
def run(self):
|
||||
queue_not_serviced_count = 0
|
||||
device_socket = None
|
||||
get_all_ips(reinitialize=True)
|
||||
|
||||
while self.keep_running:
|
||||
try:
|
||||
time.sleep(1)
|
||||
|
@ -37,13 +37,20 @@ class AllIpAddressesGetter (Thread):
|
||||
def run(self):
|
||||
global _all_ip_addresses
|
||||
# print 'sleeping'
|
||||
# time.sleep(10)
|
||||
# time.sleep(15)
|
||||
# print 'slept'
|
||||
_all_ip_addresses = self.get_all_ips()
|
||||
|
||||
AllIpAddressesGetter().start()
|
||||
_ip_address_getter_thread = None
|
||||
|
||||
def get_all_ips():
|
||||
def get_all_ips(reinitialize=False):
|
||||
global _all_ip_addresses, _ip_address_getter_thread
|
||||
if not _ip_address_getter_thread or (reinitialize and not
|
||||
_ip_address_getter_thread.is_alive()):
|
||||
_all_ip_addresses = dict()
|
||||
_ip_address_getter_thread = AllIpAddressesGetter()
|
||||
_ip_address_getter_thread.setDaemon(True)
|
||||
_ip_address_getter_thread.start()
|
||||
return _all_ip_addresses
|
||||
|
||||
def _get_external_ip():
|
||||
|
Loading…
x
Reference in New Issue
Block a user