Skip to content

Commit

Permalink
Rename lockedRemoveConnection to removeConnectionLocked for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
aruiz14 committed Jun 17, 2024
1 parent 01aa1cd commit ee938dc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions session.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,16 @@ func (s *Session) removeConnection(connID int64) *connection {
s.Lock()
defer s.Unlock()

conn := s.lockedRemoveConnection(connID)
conn := s.removeConnectionLocked(connID)
if PrintTunnelData {
defer logrus.Debugf("CONNECTIONS %d %d", s.sessionKey, len(s.conns))
}
return conn
}

// lockedRemoveConnection removes a given connection from the session. The session lock must be held by the caller when calling this method
func (s *Session) lockedRemoveConnection(connID int64) *connection {
// removeConnectionLocked removes a given connection from the session.
// The session lock must be held by the caller when calling this method
func (s *Session) removeConnectionLocked(connID int64) *connection {
conn := s.conns[connID]
delete(s.conns, connID)
return conn
Expand Down
2 changes: 1 addition & 1 deletion session_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (s *Session) closeStaleConnections(clientIDs []int64) {
defer s.Unlock()
for _, id := range toClose {
// Connection no longer active in the client, close it server-side
conn := s.lockedRemoveConnection(id)
conn := s.removeConnectionLocked(id)
if conn != nil {
// Using doTunnelClose directly instead of tunnelClose, omitting unnecessarily sending an Error message
conn.doTunnelClose(errCloseSyncConnections)
Expand Down

0 comments on commit ee938dc

Please sign in to comment.