working lobby!

This commit is contained in:
Beric Bearnson
2024-08-24 16:09:12 -06:00
parent e5df746e7f
commit b3df666196
4 changed files with 135 additions and 47 deletions
+6 -2
View File
@@ -40,11 +40,16 @@ func init() {
msg := <-externalMessageChan
player, ok := lobbyMembers.Load(msg.Target)
if !ok {
log.Println("failed to send to target", msg.Target)
continue
}
client, _ := player.(Client)
bytes, _ := proto.Marshal(msg.Message)
client.Conn.Write(bytes)
_, err := client.Conn.Write(bytes)
if err != nil {
log.Println("Could not write to target", msg.Target, err)
}
}
}()
}
@@ -62,7 +67,6 @@ func LobbyListen() {
for {
conn, err := listener.Accept()
log.Println("got a connection!")
if err != nil {
log.Println(err)
continue