forked from jshiffer/matterbridge
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.
This commit is contained in:
parent
a8d4a27de1
commit
8eba2d3e50
@ -123,14 +123,14 @@ func (b *Birc) handleNewConnection(client *girc.Client, event girc.Event) {
|
|||||||
i := b.i
|
i := b.i
|
||||||
b.Nick = event.Params[0]
|
b.Nick = event.Params[0]
|
||||||
|
|
||||||
i.Handlers.Add("PRIVMSG", b.handlePrivMsg)
|
i.Handlers.AddBg("PRIVMSG", b.handlePrivMsg)
|
||||||
i.Handlers.Add("CTCP_ACTION", b.handlePrivMsg)
|
i.Handlers.AddBg("CTCP_ACTION", b.handlePrivMsg)
|
||||||
i.Handlers.Add(girc.RPL_TOPICWHOTIME, b.handleTopicWhoTime)
|
i.Handlers.Add(girc.RPL_TOPICWHOTIME, b.handleTopicWhoTime)
|
||||||
i.Handlers.Add(girc.NOTICE, b.handleNotice)
|
i.Handlers.AddBg(girc.NOTICE, b.handleNotice)
|
||||||
i.Handlers.Add("JOIN", b.handleJoinPart)
|
i.Handlers.AddBg("JOIN", b.handleJoinPart)
|
||||||
i.Handlers.Add("PART", b.handleJoinPart)
|
i.Handlers.AddBg("PART", b.handleJoinPart)
|
||||||
i.Handlers.Add("QUIT", b.handleJoinPart)
|
i.Handlers.AddBg("QUIT", b.handleJoinPart)
|
||||||
i.Handlers.Add("KICK", b.handleJoinPart)
|
i.Handlers.AddBg("KICK", b.handleJoinPart)
|
||||||
i.Handlers.Add("INVITE", b.handleInvite)
|
i.Handlers.Add("INVITE", b.handleInvite)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user