RPL_WHOISACTUALLY should display some arbitrarily chosen IP address and
hostname.
This commit is contained in:
Shivaram Lingamneni 2021-08-25 22:31:38 -04:00
parent 8b2f6de3e0
commit 26cdb4cf36
3 changed files with 14 additions and 6 deletions

View file

@ -145,6 +145,17 @@ func (client *Client) removeSession(session *Session) (success bool, length int)
return
}
// #1650: show an arbitrarily chosen session IP and hostname in RPL_WHOISACTUALLY
func (client *Client) getWhoisActually() (ip net.IP, hostname string) {
client.stateMutex.RLock()
defer client.stateMutex.RUnlock()
for _, session := range client.sessions {
return session.IP(), session.rawHostname
}
return utils.IPv4LoopbackAddress, client.server.name
}
func (client *Client) Nick() string {
client.stateMutex.RLock()
defer client.stateMutex.RUnlock()