From d137a50d417297787f689c623f0f2cb6765d181f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20I=C3=B1iguez=20Goia?= Date: Tue, 28 Jul 2020 22:38:53 +0200 Subject: [PATCH] check GUI and daemon versions granularly Do not display the warning dialog about diferent versions (daemon<->GUI), if we only have relesed fixes or minor changes. --- ui/opensnitch/service.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ui/opensnitch/service.py b/ui/opensnitch/service.py index e95462d5b0..5db3a3ab1d 100644 --- a/ui/opensnitch/service.py +++ b/ui/opensnitch/service.py @@ -220,6 +220,12 @@ def _async_worker(self): self._status_change_trigger.emit() was_connected = self._connected + def _check_versions(self, daemon_version): + lMayor, lMinor, lPatch = version.split(".") + rMayor, rMinor, rPatch = daemon_version.split(".") + if lMayor != rMayor or (lMayor == rMayor and lMinor != rMinor): + self._version_warning_trigger.emit(daemon_version, version) + def _is_local_request(self, proto, addr): if proto == "unix": return True @@ -372,8 +378,7 @@ def _populate_stats_events(self, db, addr, stats, table, colnames, cols, items): def Ping(self, request, context): try: self._last_ping = datetime.now() - if request.stats.daemon_version != version: - self._version_warning_trigger.emit(request.stats.daemon_version, version) + self._check_versions(request.stats.daemon_version) proto, addr = self._get_peer(context.peer()) # do not update db here, do it on the main thread