From 8250a39534daca9ab9de1074a2395d7a2278c174 Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Fri, 16 Apr 2021 09:48:11 -0700 Subject: [PATCH] fix: delete room if full and third-party tries to enter --- src/tcp/tcp.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tcp/tcp.go b/src/tcp/tcp.go index 35f990a5..8a40426d 100644 --- a/src/tcp/tcp.go +++ b/src/tcp/tcp.go @@ -266,6 +266,7 @@ func (s *server) clientCommunication(port string, c *comm.Comm) (room string, er return } if s.rooms.rooms[room].full { + defer s.deleteRoom(room) s.rooms.Unlock() bSend, err = crypt.Encrypt([]byte("room full"), strongKeyForEncryption) if err != nil { @@ -274,7 +275,6 @@ func (s *server) clientCommunication(port string, c *comm.Comm) (room string, er err = c.Send(bSend) if err != nil { log.Error(err) - s.deleteRoom(room) return } return