Browse Source

pointless optimization

tags/v2.4.0-rc1
Shivaram Lingamneni 3 years ago
parent
commit
a6d793a2d5
2 changed files with 5 additions and 3 deletions
  1. 4
    2
      irc/getters.go
  2. 1
    1
      irc/nickserv.go

+ 4
- 2
irc/getters.go View File

@@ -76,7 +76,7 @@ type SessionData struct {
76 76
 	sessionID int64
77 77
 }
78 78
 
79
-func (client *Client) AllSessionData(currentSession *Session) (data []SessionData, currentIndex int) {
79
+func (client *Client) AllSessionData(currentSession *Session, hasPrivs bool) (data []SessionData, currentIndex int) {
80 80
 	currentIndex = -1
81 81
 	client.stateMutex.RLock()
82 82
 	defer client.stateMutex.RUnlock()
@@ -93,13 +93,15 @@ func (client *Client) AllSessionData(currentSession *Session) (data []SessionDat
93 93
 			certfp:    session.certfp,
94 94
 			deviceID:  session.deviceID,
95 95
 			sessionID: session.sessionID,
96
-			connInfo:  utils.DescribeConn(session.socket.conn.UnderlyingConn().Conn),
97 96
 		}
98 97
 		if session.proxiedIP != nil {
99 98
 			data[i].ip = session.proxiedIP
100 99
 		} else {
101 100
 			data[i].ip = session.realIP
102 101
 		}
102
+		if hasPrivs {
103
+			data[i].connInfo = utils.DescribeConn(session.socket.conn.UnderlyingConn().Conn)
104
+		}
103 105
 	}
104 106
 	return
105 107
 }

+ 1
- 1
irc/nickserv.go View File

@@ -1116,7 +1116,7 @@ func nsClientsListHandler(server *Server, client *Client, params []string, rb *R
1116 1116
 		}
1117 1117
 	}
1118 1118
 
1119
-	sessionData, currentIndex := target.AllSessionData(rb.session)
1119
+	sessionData, currentIndex := target.AllSessionData(rb.session, hasPrivs)
1120 1120
 	nsNotice(rb, fmt.Sprintf(client.t("Nickname %[1]s has %[2]d attached clients(s)"), target.Nick(), len(sessionData)))
1121 1121
 	for i, session := range sessionData {
1122 1122
 		if currentIndex == i {

Loading…
Cancel
Save