forked from minetest-mods/irc
Fix issue with previous commit.
Mea culpa. It was possible an error caused `require` to not be reset, causing possible errors in the future.
This commit is contained in:
parent
9f8b4fd4af
commit
0c8538bfb8
13
init.lua
13
init.lua
@ -110,11 +110,13 @@ function irc:connect()
|
|||||||
realname = "Minetest",
|
realname = "Minetest",
|
||||||
})
|
})
|
||||||
self:doHook(self.conn)
|
self:doHook(self.conn)
|
||||||
|
|
||||||
|
-- We need to swap the `require` function again since
|
||||||
|
-- LuaIRC `require`s `ssl` if `irc.secure` is true.
|
||||||
|
local old_require = require
|
||||||
|
require = ie.require
|
||||||
|
|
||||||
local good, message = pcall(function()
|
local good, message = pcall(function()
|
||||||
-- We need to swap the `require` function again since
|
|
||||||
-- LuaIRC `require`s `ssl` if `irc.secure` is true.
|
|
||||||
local old_require = require
|
|
||||||
require = ie.require
|
|
||||||
self.conn:connect({
|
self.conn:connect({
|
||||||
host = self.config.server,
|
host = self.config.server,
|
||||||
port = self.config.port,
|
port = self.config.port,
|
||||||
@ -123,9 +125,10 @@ function irc:connect()
|
|||||||
reconnect = self.config.reconnect,
|
reconnect = self.config.reconnect,
|
||||||
secure = self.config.secure
|
secure = self.config.secure
|
||||||
})
|
})
|
||||||
require = old_require
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
require = old_require
|
||||||
|
|
||||||
if not good then
|
if not good then
|
||||||
minetest.log("error", ("IRC: Connection error: %s: %s -- Reconnecting in %d seconds...")
|
minetest.log("error", ("IRC: Connection error: %s: %s -- Reconnecting in %d seconds...")
|
||||||
:format(self.config.server, message, self.config.reconnect))
|
:format(self.config.server, message, self.config.reconnect))
|
||||||
|
Loading…
Reference in New Issue
Block a user