mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-10 22:19:31 +01:00
pointless optimization
This commit is contained in:
parent
1bbf6ab936
commit
a6d793a2d5
@ -76,7 +76,7 @@ type SessionData struct {
|
|||||||
sessionID int64
|
sessionID int64
|
||||||
}
|
}
|
||||||
|
|
||||||
func (client *Client) AllSessionData(currentSession *Session) (data []SessionData, currentIndex int) {
|
func (client *Client) AllSessionData(currentSession *Session, hasPrivs bool) (data []SessionData, currentIndex int) {
|
||||||
currentIndex = -1
|
currentIndex = -1
|
||||||
client.stateMutex.RLock()
|
client.stateMutex.RLock()
|
||||||
defer client.stateMutex.RUnlock()
|
defer client.stateMutex.RUnlock()
|
||||||
@ -93,13 +93,15 @@ func (client *Client) AllSessionData(currentSession *Session) (data []SessionDat
|
|||||||
certfp: session.certfp,
|
certfp: session.certfp,
|
||||||
deviceID: session.deviceID,
|
deviceID: session.deviceID,
|
||||||
sessionID: session.sessionID,
|
sessionID: session.sessionID,
|
||||||
connInfo: utils.DescribeConn(session.socket.conn.UnderlyingConn().Conn),
|
|
||||||
}
|
}
|
||||||
if session.proxiedIP != nil {
|
if session.proxiedIP != nil {
|
||||||
data[i].ip = session.proxiedIP
|
data[i].ip = session.proxiedIP
|
||||||
} else {
|
} else {
|
||||||
data[i].ip = session.realIP
|
data[i].ip = session.realIP
|
||||||
}
|
}
|
||||||
|
if hasPrivs {
|
||||||
|
data[i].connInfo = utils.DescribeConn(session.socket.conn.UnderlyingConn().Conn)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1116,7 +1116,7 @@ func nsClientsListHandler(server *Server, client *Client, params []string, rb *R
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sessionData, currentIndex := target.AllSessionData(rb.session)
|
sessionData, currentIndex := target.AllSessionData(rb.session, hasPrivs)
|
||||||
nsNotice(rb, fmt.Sprintf(client.t("Nickname %[1]s has %[2]d attached clients(s)"), target.Nick(), len(sessionData)))
|
nsNotice(rb, fmt.Sprintf(client.t("Nickname %[1]s has %[2]d attached clients(s)"), target.Nick(), len(sessionData)))
|
||||||
for i, session := range sessionData {
|
for i, session := range sessionData {
|
||||||
if currentIndex == i {
|
if currentIndex == i {
|
||||||
|
Loading…
Reference in New Issue
Block a user