Просмотр исходного кода

Explicitly ensure map in initialized
- Map happens to be initialized in accepted
client loop, but that could change

Rod Hynes 9 лет назад
Родитель
Сommit
2769a6da08
1 измененных файлов с 4 добавлено и 0 удалено
  1. 4 0
      psiphon/server/tunnelServer.go

+ 4 - 0
psiphon/server/tunnelServer.go

@@ -483,6 +483,10 @@ func (sshServer *sshServer) getLoadStats() map[string]interface{} {
 
 		for _, region := range []string{"ALL", client.geoIPData.Country} {
 
+			if protocolStats[tunnelProtocol][region] == nil {
+				protocolStats[tunnelProtocol][region] = make(map[string]int64)
+			}
+
 			// Note: can't sum trafficState.peakConcurrentPortForwardCount to get a global peak
 			protocolStats[client.tunnelProtocol][region]["established_clients"] += 1