From 4db7faa956c352e70c7cf0c77aeb49ae5472e243 Mon Sep 17 00:00:00 2001 From: Guillaume ARM Date: Sun, 17 Jul 2022 20:22:35 +0200 Subject: [PATCH] fix: ping bad timeout error --- ping.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ping.lua b/ping.lua index 6a3acc4..03c7c69 100644 --- a/ping.lua +++ b/ping.lua @@ -1,4 +1,4 @@ --- ping v2.0.0 +-- ping v2.0.1 local PING_CHANNEL = 9; local createNet = require('/apis/net'); @@ -16,14 +16,22 @@ if targetComputerId == nil or targetComputerId == sourceId or targetComputerId = .. (sourceLabel and " (label=" .. tostring(sourceLabel) .. ")" or "")); end +if targetComputerId == sourceId then + return; +end + -- envoyer un message sur le canal 9 à la machine cible local ok, results, packets = net.sendMultipleRequests(PING_CHANNEL, 'ping', 'ping', targetComputerId); -if not ok then +if not ok and (targetComputerId ~= sourceId and targetComputerId ~= sourceLabel) then error(results) end +if not ok then + return; +end + for k, message in ipairs(results) do if message == 'pong' then local packet = packets[k];