From 3c235e22edea8e0909ddf8c03b4c57470d815b6b Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Sat, 15 Mar 2025 17:43:28 +0900 Subject: [PATCH] chore: update changelog --- CHANGELOG.md | 1 + dzgui.sh | 4 ++-- helpers/funcs | 14 ++++++++++---- helpers/ui.py | 8 +++++--- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index db373d1..5bdbc03 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ ## Fixed - Grid scaling causes table to exceeds bounds of display viewport - Window exceeds taskbar on Steam Deck +- Reduce possibility of timeouts when pinging servers ## Changed - Packed filter checkbox buttons into a 3x3 grid - Updated IP database to 2025-03 records diff --git a/dzgui.sh b/dzgui.sh index 74f5cb7..41cf671 100755 --- a/dzgui.sh +++ b/dzgui.sh @@ -587,10 +587,10 @@ fetch_helpers_by_sum(){ [[ -f "$config_file" ]] && source "$config_file" declare -A sums sums=( - ["ui.py"]="dfec256412be2bfb83d69ad873f244e1" + ["ui.py"]="121f27e51c945d78e97b77397d3c5173" ["query_v2.py"]="55d339ba02512ac69de288eb3be41067" ["vdf2json.py"]="2f49f6f5d3af919bebaab2e9c220f397" - ["funcs"]="0d2d7a2b08f1112dc2474ba81a489002" + ["funcs"]="fd7c23e39a70099a7f0006afd8919508" ["lan"]="c62e84ddd1457b71a85ad21da662b9af" ) local author="aclist" diff --git a/helpers/funcs b/helpers/funcs index 80f45f2..4f7f02d 100755 --- a/helpers/funcs +++ b/helpers/funcs @@ -784,12 +784,18 @@ logger(){ } test_ping(){ shift + local time local ip="$1" local qport="$2" - local res - res=$(ping -c1 -4 -W0.5 $1 | grep time= | awk -F= '{print $4}') - [[ ! $? -eq 0 ]] && res="Timed out" - printf "%s" "$res" + log "$ip" + log "$qport" + res=$(a2s $ip $qport info) + if [[ -z $res ]]; then + time="Timed out" + else + time=$(<<< "$res" jq -r '.[].ping') + fi + printf "%s" "$time" } show_server_modlist(){ shift diff --git a/helpers/ui.py b/helpers/ui.py index 7ef7db8..1995e83 100644 --- a/helpers/ui.py +++ b/helpers/ui.py @@ -1091,12 +1091,13 @@ class ButtonBox(Gtk.Box): class CalcDist(multiprocessing.Process): - def __init__(self, widget, addr, result_queue, cache): + def __init__(self, widget, addr, qport, result_queue, cache): super().__init__() self.widget = widget self.result_queue = result_queue self.addr = addr + self.qport = str(qport) self.ip = addr.split(':')[0] def run(self): @@ -1105,7 +1106,7 @@ class CalcDist(multiprocessing.Process): self.result_queue.put([self.addr, cache[self.addr][0], cache[self.addr][1]]) return proc = call_out(self.widget, "get_dist", self.ip) - proc2 = call_out(self.widget, "test_ping", self.ip) + proc2 = call_out(self.widget, "test_ping", self.ip, self.qport) km = proc.stdout ping = proc2.stdout self.result_queue.put([self.addr, km, ping]) @@ -1332,6 +1333,7 @@ class TreeView(Gtk.TreeView): if self.view == WindowContext.TABLE_API or self.view == WindowContext.TABLE_SERVER: addr = self.get_column_at_index(7) + qport = self.get_column_at_index(8) if addr is None: server_tooltip[0] = format_tooltip() grid.update_statusbar(server_tooltip[0]) @@ -1345,7 +1347,7 @@ class TreeView(Gtk.TreeView): grid.update_statusbar(tooltip) return self.emit("on_distcalc_started") - self.current_proc = CalcDist(self, addr, self.queue, cache) + self.current_proc = CalcDist(self, addr, qport, self.queue, cache) self.current_proc.start() else: tooltip = format_metadata(row_sel)