From 8eba2d3e50353b9cfe240f8c5b167a6c26bbd3c4 Mon Sep 17 00:00:00 2001 From: Wim Date: Sat, 5 Dec 2020 21:41:45 +0100 Subject: Make handlers run async (irc) (#1325) This makes the handlers run in a seperate go-routine in girc, and makes sure that girc isn't blocked on executing PONG requests when matterbridge takes a long time handling the incoming message. This can happen when another bridge is in a backoff state where the backoff time exceeds the IRC ping timeout. --- bridge/irc/handlers.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bridge/irc/handlers.go b/bridge/irc/handlers.go index 6310f57e..b90fa3af 100644 --- a/bridge/irc/handlers.go +++ b/bridge/irc/handlers.go @@ -123,14 +123,14 @@ func (b *Birc) handleNewConnection(client *girc.Client, event girc.Event) { i := b.i b.Nick = event.Params[0] - i.Handlers.Add("PRIVMSG", b.handlePrivMsg) - i.Handlers.Add("CTCP_ACTION", b.handlePrivMsg) + i.Handlers.AddBg("PRIVMSG", b.handlePrivMsg) + i.Handlers.AddBg("CTCP_ACTION", b.handlePrivMsg) i.Handlers.Add(girc.RPL_TOPICWHOTIME, b.handleTopicWhoTime) - i.Handlers.Add(girc.NOTICE, b.handleNotice) - i.Handlers.Add("JOIN", b.handleJoinPart) - i.Handlers.Add("PART", b.handleJoinPart) - i.Handlers.Add("QUIT", b.handleJoinPart) - i.Handlers.Add("KICK", b.handleJoinPart) + i.Handlers.AddBg(girc.NOTICE, b.handleNotice) + i.Handlers.AddBg("JOIN", b.handleJoinPart) + i.Handlers.AddBg("PART", b.handleJoinPart) + i.Handlers.AddBg("QUIT", b.handleJoinPart) + i.Handlers.AddBg("KICK", b.handleJoinPart) i.Handlers.Add("INVITE", b.handleInvite) } -- cgit v1.2.3