aboutsummaryrefslogtreecommitdiff
path: root/hotline
diff options
context:
space:
mode:
authorJeff Halter <868228+jhalter@users.noreply.github.com>2022-11-21 08:21:24 -0800
committerJeff Halter <868228+jhalter@users.noreply.github.com>2022-11-21 08:21:24 -0800
commitde7d2b1d64a8c441db09de5cc3284d4fab0bd44b (patch)
tree5d1d0310c19a002331110320c8d49fbba72cafba /hotline
parentbcd7859f4e07ba4fcdf8fdaf7ed2947b756885db (diff)
Fix mutex lock bug on invalid client
Diffstat (limited to 'hotline')
-rw-r--r--hotline/server.go3
1 files changed, 1 insertions, 2 deletions
diff --git a/hotline/server.go b/hotline/server.go
index bd15a2e..e28ff9a 100644
--- a/hotline/server.go
+++ b/hotline/server.go
@@ -152,13 +152,12 @@ func (s *Server) sendTransaction(t Transaction) error {
}
s.mux.Lock()
+ defer s.mux.Unlock()
client := s.Clients[uint16(clientID)]
if client == nil {
return fmt.Errorf("invalid client id %v", *t.clientID)
}
- s.mux.Unlock()
-
b, err := t.MarshalBinary()
if err != nil {
return err