Use more descriptive errors when aborting pending commands

This commit is contained in:
Simon Ser 2021-12-06 22:33:50 +01:00
parent 5c819a2c6c
commit b6c47a517c
2 changed files with 4 additions and 4 deletions

View File

@ -292,7 +292,7 @@ func (uc *upstreamConn) isOurNick(nick string) bool {
return uc.nickCM == uc.network.casemap(nick) return uc.nickCM == uc.network.casemap(nick)
} }
func (uc *upstreamConn) endPendingCommands() { func (uc *upstreamConn) abortPendingCommands() {
for _, l := range uc.pendingCmds { for _, l := range uc.pendingCmds {
for _, pendingCmd := range l { for _, pendingCmd := range l {
dc := uc.downstreamByID(pendingCmd.downstreamID) dc := uc.downstreamByID(pendingCmd.downstreamID)
@ -305,7 +305,7 @@ func (uc *upstreamConn) endPendingCommands() {
dc.SendMessage(&irc.Message{ dc.SendMessage(&irc.Message{
Prefix: dc.srv.prefix(), Prefix: dc.srv.prefix(),
Command: irc.RPL_LISTEND, Command: irc.RPL_LISTEND,
Params: []string{dc.nick, "End of /LIST"}, Params: []string{dc.nick, "Command aborted"},
}) })
case "WHO": case "WHO":
mask := "*" mask := "*"
@ -315,7 +315,7 @@ func (uc *upstreamConn) endPendingCommands() {
dc.SendMessage(&irc.Message{ dc.SendMessage(&irc.Message{
Prefix: dc.srv.prefix(), Prefix: dc.srv.prefix(),
Command: irc.RPL_ENDOFWHO, Command: irc.RPL_ENDOFWHO,
Params: []string{dc.nick, mask, "End of /WHO"}, Params: []string{dc.nick, mask, "Command aborted"},
}) })
case "AUTHENTICATE": case "AUTHENTICATE":
dc.endSASL(&irc.Message{ dc.endSASL(&irc.Message{

View File

@ -726,7 +726,7 @@ func (u *user) run() {
func (u *user) handleUpstreamDisconnected(uc *upstreamConn) { func (u *user) handleUpstreamDisconnected(uc *upstreamConn) {
uc.network.conn = nil uc.network.conn = nil
uc.endPendingCommands() uc.abortPendingCommands()
for _, entry := range uc.channels.innerMap { for _, entry := range uc.channels.innerMap {
uch := entry.value.(*upstreamChannel) uch := entry.value.(*upstreamChannel)