Skip to content

Commit

Permalink
Merge pull request #7 from eamayer/fix-race-condition
Browse files Browse the repository at this point in the history
Update server.go to reduce race condition in test suite

Change the udpErr and tcpErr to close earlier in the close function of server.go to reduce likelihood of race condition in test suite where TestClient_Auth, TestClient_Healthcheck, and TestClient_TcpKeyMatch/returns_ordered_keys_with_secret intermittently fail because the udp address is detected as already being in use.
  • Loading branch information
ruffrey authored Aug 14, 2023
2 parents c77e101 + cf05136 commit 2c4e314
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@ func (s *Server) Close() error {
return nil
}
s.disposed = true
udpErr := s.conn.Close()
tcpErr := s.tcpConn.Close()

s.store.DisableCleanup()
close(s.messageProcessing)
udpErr := s.conn.Close()
tcpErr := s.tcpConn.Close()

if udpErr != nil {
return udpErr
Expand Down

0 comments on commit 2c4e314

Please sign in to comment.