forked from External/ergo
fix #1650
RPL_WHOISACTUALLY should display some arbitrarily chosen IP address and hostname.
This commit is contained in:
parent
8b2f6de3e0
commit
26cdb4cf36
3 changed files with 14 additions and 6 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue