From 7881f62e2094cd960d70ec1d051a89b8302e00e7 Mon Sep 17 00:00:00 2001 From: yago Date: Mon, 22 Dec 2014 21:43:36 +0100 Subject: [PATCH] closed tcp conexion --- plugins/ping.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/ping.lua b/plugins/ping.lua index 553d9e4..63f0ea4 100644 --- a/plugins/ping.lua +++ b/plugins/ping.lua @@ -3,12 +3,15 @@ socket = require("socket") function cron() -- Checks a TCP connexion -- Use yours desired web and id - local addr = "your.web.site" - local dest = "user#id"..our_id - if not socket.connect(addr, 80) then + local addr = "gul.es" + local dest = "user#id"..our_id + local connexion = socket.connect(addr, 80) + if not connexion then local text = "ALERT: "..addr.." is offline" print (text) send_msg(dest, text, ok_cb, false) + else + connexion:close() end end