mirror of
https://github.com/ShadowKatStudios/OC-Minitel.git
synced 2024-11-23 02:28:05 +11:00
Do not unregister listeners on unexpected data
If a registered event listener callback returns `false`, the listener is unregistered. A network packet arriving on a different port, or a message with a missing part, should not cause the syslog system to shut down. Return `nil` instead of `false` if those sanity checks fail, to keep the listener registered.
This commit is contained in:
parent
4c462a5d4e
commit
074a980d81
@ -69,15 +69,15 @@ local function wentry(_,msg,level,service,host)
|
||||
end
|
||||
|
||||
local function remote_listener(_,from,port,data)
|
||||
if port ~= cfg.port then return false end
|
||||
if port ~= cfg.port then return end
|
||||
local service, level, msg = data:match("(.-)\t(%d)\t(.+)")
|
||||
if not service or not level or not msg then return false end
|
||||
if not service or not level or not msg then return end
|
||||
msg, level, service = tostring(msg),tonumber(level),tostring(service)
|
||||
wentry(nil,msg,level,service,from)
|
||||
end
|
||||
|
||||
local function local_listener(_,msg,level,service)
|
||||
if not service or not level or not msg then return false end
|
||||
if not service or not level or not msg then return end
|
||||
msg, level, service = tostring(msg),tonumber(level),tostring(service)
|
||||
wentry(nil,msg,level,service,hostname)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user