Sfoglia il codice sorgente

pointless optimization

tags/v2.4.0-rc1
Shivaram Lingamneni 3 anni fa
parent
commit
a6d793a2d5
2 ha cambiato i file con 5 aggiunte e 3 eliminazioni
  1. 4
    2
      irc/getters.go
  2. 1
    1
      irc/nickserv.go

+ 4
- 2
irc/getters.go Vedi File

76
 	sessionID int64
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
 	currentIndex = -1
80
 	currentIndex = -1
81
 	client.stateMutex.RLock()
81
 	client.stateMutex.RLock()
82
 	defer client.stateMutex.RUnlock()
82
 	defer client.stateMutex.RUnlock()
93
 			certfp:    session.certfp,
93
 			certfp:    session.certfp,
94
 			deviceID:  session.deviceID,
94
 			deviceID:  session.deviceID,
95
 			sessionID: session.sessionID,
95
 			sessionID: session.sessionID,
96
-			connInfo:  utils.DescribeConn(session.socket.conn.UnderlyingConn().Conn),
97
 		}
96
 		}
98
 		if session.proxiedIP != nil {
97
 		if session.proxiedIP != nil {
99
 			data[i].ip = session.proxiedIP
98
 			data[i].ip = session.proxiedIP
100
 		} else {
99
 		} else {
101
 			data[i].ip = session.realIP
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
 	return
106
 	return
105
 }
107
 }

+ 1
- 1
irc/nickserv.go Vedi File

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

Loading…
Annulla
Salva