Browse Source

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

Rod Hynes 9 years ago
parent
commit
2769a6da08
1 changed files with 4 additions and 0 deletions
  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} {
 		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
 			// Note: can't sum trafficState.peakConcurrentPortForwardCount to get a global peak
 			protocolStats[client.tunnelProtocol][region]["established_clients"] += 1
 			protocolStats[client.tunnelProtocol][region]["established_clients"] += 1