@@ -23,7 +23,7 @@ type GameData struct {
2323 playerAddresses [4 ]* net.UDPAddr
2424 bufferSize uint32
2525 averageBufferHealth [4 ]float32
26- bufferHealth [4 ]* lru. Cache [ uint32 , byte ]
26+ bufferHealth [4 ][] byte
2727 inputs [4 ]* lru.Cache [uint32 , InputData ]
2828 pendingInput [4 ]InputData
2929 countLag [4 ]uint32
@@ -151,7 +151,7 @@ func (g *GameServer) processUDP(addr *net.UDPAddr) {
151151 }
152152 g .gameData .countLag [sendingPlayerNumber ] = g .sendUDPInput (count , addr , playerNumber , spectator != 0 , sendingPlayerNumber )
153153 g .gameDataMutex .Lock () // PlayerAlive and BufferHealth can be modified in different threads
154- g .gameData .bufferHealth [sendingPlayerNumber ]. Add ( count , g .gameData .recvBuffer [11 ])
154+ g .gameData .bufferHealth [sendingPlayerNumber ] = append ( g . gameData . bufferHealth [ sendingPlayerNumber ] , g .gameData .recvBuffer [11 ])
155155 g .gameData .playerAlive [sendingPlayerNumber ] = true
156156 g .gameDataMutex .Unlock ()
157157 case CP0Info :
@@ -213,7 +213,7 @@ func (g *GameServer) createUDPServer() error {
213213 g .gameData .bufferSize = 3
214214 for i := range 4 {
215215 g .gameData .inputs [i ], _ = lru.New [uint32 , InputData ](InputDataMax )
216- g .gameData .bufferHealth [i ], _ = lru. New [ uint32 , byte ]( InputDataMax )
216+ g .gameData .bufferHealth [i ] = make ([] byte , 0 , InputDataMax )
217217 }
218218 g .gameData .syncValues , _ = lru.New [uint32 , []byte ](100 ) // Store up to 100 sync values
219219 g .gameData .sendBuffer = make ([]byte , 508 )
0 commit comments