Skip to content

Commit 58e497e

Browse files
danegstaCopilot
andcommitted
Remove unused port reservation query
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 98eeb6d commit 58e497e

1 file changed

Lines changed: 0 additions & 34 deletions

File tree

internal/statestore/ports.go

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -79,40 +79,6 @@ func (s *Store) CreateOrUpdatePortReservation(ctx context.Context, request PortR
7979
return s.reservePort(ctx, request, true)
8080
}
8181

82-
// IsPortReservedByOtherOwner reports whether an active owner other than ownerProcess holds the
83-
// requested protocol/IP/port tuple or a conflicting same-family wildcard tuple.
84-
func (s *Store) IsPortReservedByOtherOwner(ctx context.Context, binding ports.Binding, ownerProcess process.ProcessTreeItem) (bool, error) {
85-
key, portErr := normalizePortReservationKey(binding)
86-
if portErr != nil {
87-
return false, portErr
88-
}
89-
normalizedOwner, ownerErr := normalizeResourceLeaseOwner(ownerProcess)
90-
if ownerErr != nil {
91-
return false, fmt.Errorf("%w: %w", ErrInvalidArgument, ownerErr)
92-
}
93-
94-
db, dbErr := s.requireDB()
95-
if dbErr != nil {
96-
return false, dbErr
97-
}
98-
99-
reservations, reservationsErr := getConflictingPortReservations(ctx, db, key)
100-
if reservationsErr != nil {
101-
return false, reservationsErr
102-
}
103-
for _, reservation := range reservations {
104-
if reservation.OwnerProcess.Pid == normalizedOwner.Pid &&
105-
reservation.OwnerProcess.IdentityTime.Equal(normalizedOwner.IdentityTime) {
106-
continue
107-
}
108-
if resourceLeaseOwnerIsActive(reservation.OwnerProcess) {
109-
return true, nil
110-
}
111-
}
112-
113-
return false, nil
114-
}
115-
11682
// ReleasePort removes this owner process' exact protocol/IP/port reservation.
11783
// Reservations held by other owners, or overlapping wildcard/specific reservations, are left intact.
11884
func (s *Store) ReleasePort(ctx context.Context, request PortReservationRequest) error {

0 commit comments

Comments
 (0)