@@ -128,12 +128,12 @@ func (g *GameServer) tcpSendReg(conn *net.TCPConn) {
128128 registrations := make ([]byte , 24 )
129129 current := 0
130130 for i = range 4 {
131- if v , ok := g .registrations .Load (i ); ok {
132- binary .BigEndian .PutUint32 (registrations [current :], v .(Registration ).regID )
131+ if reg , ok := g .registrations .Load (i ); ok {
132+ binary .BigEndian .PutUint32 (registrations [current :], reg .(Registration ).regID )
133133 current += 4
134- registrations [current ] = v .(Registration ).plugin
134+ registrations [current ] = reg .(Registration ).plugin
135135 current ++
136- registrations [current ] = v .(Registration ).raw
136+ registrations [current ] = reg .(Registration ).raw
137137 current ++
138138 } else {
139139 current += 6
@@ -281,12 +281,12 @@ func (g *GameServer) processTCP(conn *net.TCPConn) {
281281 regID := binary .BigEndian .Uint32 (regIDBytes )
282282
283283 response := make ([]byte , 2 )
284- if v , ok := g .registrations .Load (playerNumber ); ok {
285- if v .(Registration ).regID == regID {
286- g .Logger .Error (fmt .Errorf ("re-registration" ), "player already registered" , "registration" , v .(Registration ), "number" , playerNumber , "bufferLeft" , tcpData .buffer .Len (), "address" , conn .RemoteAddr ().String ())
284+ if reg , ok := g .registrations .Load (playerNumber ); ok {
285+ if reg .(Registration ).regID == regID {
286+ g .Logger .Error (fmt .Errorf ("re-registration" ), "player already registered" , "registration" , reg .(Registration ), "number" , playerNumber , "bufferLeft" , tcpData .buffer .Len (), "address" , conn .RemoteAddr ().String ())
287287 response [0 ] = 1
288288 } else {
289- g .Logger .Error (fmt .Errorf ("registration failure" ), "could not register player" , "registration" , v .(Registration ), "number" , playerNumber , "bufferLeft" , tcpData .buffer .Len (), "address" , conn .RemoteAddr ().String ())
289+ g .Logger .Error (fmt .Errorf ("registration failure" ), "could not register player" , "registration" , reg .(Registration ), "number" , playerNumber , "bufferLeft" , tcpData .buffer .Len (), "address" , conn .RemoteAddr ().String ())
290290 response [0 ] = 0
291291 }
292292 } else {
@@ -331,8 +331,8 @@ func (g *GameServer) processTCP(conn *net.TCPConn) {
331331 regID := binary .BigEndian .Uint32 (regIDBytes )
332332 var i byte
333333 for i = range 4 {
334- if v , ok := g .registrations .Load (i ); ok {
335- if v .(Registration ).regID == regID {
334+ if reg , ok := g .registrations .Load (i ); ok {
335+ if reg .(Registration ).regID == regID {
336336 g .Logger .Info ("player disconnected TCP" , "regID" , regID , "player" , i , "address" , conn .RemoteAddr ().String ())
337337
338338 g .gameDataMutex .Lock ()
0 commit comments