mirror of
https://github.com/jeremyd/ergo.git
synced 2026-07-26 09:08:11 -07:00
socket: Move to a timing-out send method that reduces goroutines and ensures QUIT/ERROR are sent
This commit is contained in:
+7
-3
@@ -436,9 +436,13 @@ func (client *Client) ChangeNickname(nickname string) error {
|
||||
// Quit sends the given quit message to the client (but does not destroy them).
|
||||
func (client *Client) Quit(message string) {
|
||||
if !client.quitMessageSent {
|
||||
client.Send(nil, client.nickMaskString, "QUIT", message)
|
||||
client.Send(nil, "", "ERROR", message)
|
||||
client.socket.Write("\r\n")
|
||||
quitMsg := ircmsg.MakeMessage(nil, client.nickMaskString, "QUIT", message)
|
||||
quitLine, _ := quitMsg.Line()
|
||||
|
||||
errorMsg := ircmsg.MakeMessage(nil, "", "ERROR", message)
|
||||
errorLine, _ := errorMsg.Line()
|
||||
|
||||
client.socket.FinalData = quitLine + errorLine
|
||||
client.quitMessageSent = true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user