working lobby-ish

This commit is contained in:
Beric Bearnson
2024-08-23 11:59:19 -06:00
parent e90b9c26b1
commit e5df746e7f
6 changed files with 94 additions and 35 deletions
+2 -12
View File
@@ -15,12 +15,12 @@ func handleGameConnection(conn net.Conn) {
log.Printf("Error reading game ID on connection", err)
}
gameID := string(messageBytes[:n])
_ = string(messageBytes[:n])
if err != nil {
log.Printf("Game id was not a string?", err)
}
clientChan := make(chan GameMessage)
_ = make(chan GameMessage)
n, err = conn.Read(messageBytes)
if err != nil {
@@ -28,16 +28,6 @@ func handleGameConnection(conn net.Conn) {
return
}
gameClients, ok := gameChans.games[gameID]
if !ok {
newGameClients := GameClients{
client1: clientChan,
client2: nil,
}
gameChans.games[gameID] = newGameClients
} else {
gameClients.client2 = clientChan
}
}
func handleGameMessage(conn net.Conn, message *GameMessage) error {