summaryrefslogtreecommitdiffstats
path: root/bridge/irc
diff options
context:
space:
mode:
authorWim <wim@42.be>2020-12-05 21:41:45 +0100
committerGitHub <noreply@github.com>2020-12-05 21:41:45 +0100
commit8eba2d3e50353b9cfe240f8c5b167a6c26bbd3c4 (patch)
treed226bf565f4bb27446c7f83713e2e6a373dfeba4 /bridge/irc
parenta8d4a27de108e9ecc0b3c641e6accbfe05c6cc8d (diff)
downloadmatterbridge-msglm-8eba2d3e50353b9cfe240f8c5b167a6c26bbd3c4.tar.gz
matterbridge-msglm-8eba2d3e50353b9cfe240f8c5b167a6c26bbd3c4.tar.bz2
matterbridge-msglm-8eba2d3e50353b9cfe240f8c5b167a6c26bbd3c4.zip
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.
Diffstat (limited to 'bridge/irc')
-rw-r--r--bridge/irc/handlers.go14
1 files 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)
}