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",
|
||||
})
|
||||
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()
|
||||
-- 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({
|
||||
host = self.config.server,
|
||||
port = self.config.port,
|
||||
|
@ -123,9 +125,10 @@ function irc:connect()
|
|||
reconnect = self.config.reconnect,
|
||||
secure = self.config.secure
|
||||
})
|
||||
require = old_require
|
||||
end)
|
||||
|
||||
require = old_require
|
||||
|
||||
if not good then
|
||||
minetest.log("error", ("IRC: Connection error: %s: %s -- Reconnecting in %d seconds...")
|
||||
:format(self.config.server, message, self.config.reconnect))
|
||||
|
|
Loading…
Reference in New Issue
Block a user