mirror of
https://github.com/samschott/maestral.git
synced 2024-10-06 10:28:07 +03:00
commit
51614e6f1f
@ -11,7 +11,7 @@ sys.path.insert(0, os.path.abspath("../src"))
|
||||
# -- Project information ---------------------------------------------------------------
|
||||
|
||||
author = "Sam Schott"
|
||||
version = "1.4.0"
|
||||
version = "1.4.1"
|
||||
release = version
|
||||
project = "Maestral"
|
||||
title = "Maestral API Documentation"
|
||||
|
@ -1,5 +1,5 @@
|
||||
[bumpversion]
|
||||
current_version = 1.4.0
|
||||
current_version = 1.4.1
|
||||
commit = True
|
||||
tag = False
|
||||
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.(?P<release>[a-z]+)(?P<build>\d+))?
|
||||
|
2
setup.py
2
setup.py
@ -55,7 +55,7 @@ setup(
|
||||
name="maestral",
|
||||
author="Sam Schott",
|
||||
author_email="ss2151@cam.ac.uk",
|
||||
version="1.4.0",
|
||||
version="1.4.1",
|
||||
url="https://github.com/SamSchott/maestral",
|
||||
description="Open-source Dropbox client for macOS and Linux.",
|
||||
license="MIT",
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
import warnings
|
||||
|
||||
__version__ = "1.4.0"
|
||||
__version__ = "1.4.1"
|
||||
__author__ = "Sam Schott"
|
||||
__url__ = "https://github.com/SamSchott/maestral"
|
||||
|
||||
|
@ -3933,19 +3933,21 @@ class SyncMonitor:
|
||||
|
||||
while self._connection_helper_running:
|
||||
|
||||
self.connected = check_connection("www.dropbox.com")
|
||||
connected = check_connection("www.dropbox.com")
|
||||
|
||||
if self.connected and not self.running.is_set() and self.autostart.is_set():
|
||||
logger.info(CONNECTED)
|
||||
self.start()
|
||||
if connected != self.connected:
|
||||
|
||||
elif not self.connected and self.running.is_set():
|
||||
# Log the status change.
|
||||
logger.info(CONNECTED if connected else CONNECTING)
|
||||
|
||||
# Don't stop sync threads, let them deal with the connection issues with
|
||||
# their own timeout. This prevents us from aborting any uploads or
|
||||
# downloads which could still be saved on reconnection.
|
||||
if not self.sync.busy():
|
||||
logger.info(IDLE)
|
||||
|
||||
logger.info(CONNECTING)
|
||||
if connected:
|
||||
if not self.running.is_set() and self.autostart.is_set():
|
||||
self.start()
|
||||
|
||||
self.connected = connected
|
||||
|
||||
time.sleep(self.connection_check_interval)
|
||||
|
||||
|
@ -193,16 +193,17 @@ def cpu_usage_percent(interval: float = 0.1) -> float:
|
||||
return round(single_cpu_percent, 1)
|
||||
|
||||
|
||||
def check_connection(hostname: str) -> bool:
|
||||
def check_connection(hostname: str, timeout: int = 2) -> bool:
|
||||
"""
|
||||
A low latency check for an internet connection.
|
||||
|
||||
:param hostname: Hostname to use for connection check.
|
||||
:param timeout: Timeout in seconds for connection check.
|
||||
:returns: Connection availability.
|
||||
"""
|
||||
try:
|
||||
host = socket.gethostbyname(hostname)
|
||||
s = socket.create_connection((host, 80), 2)
|
||||
s = socket.create_connection(address=(host, 80), timeout=timeout)
|
||||
s.close()
|
||||
return True
|
||||
except Exception:
|
||||
|
Loading…
Reference in New Issue
Block a user