|
@@ -1104,6 +1104,14 @@ func (s *InboundService) UpdateInbound(inbound *model.Inbound) (*model.Inbound,
|
|
|
s.normalizeMtprotoSecret(inbound)
|
|
s.normalizeMtprotoSecret(inbound)
|
|
|
inbound.SubSortIndex = normalizeSubSortIndex(inbound.SubSortIndex)
|
|
inbound.SubSortIndex = normalizeSubSortIndex(inbound.SubSortIndex)
|
|
|
|
|
|
|
|
|
|
+ oldInbound, err := s.GetInbound(inbound.Id)
|
|
|
|
|
+ if err != nil {
|
|
|
|
|
+ return inbound, false, err
|
|
|
|
|
+ }
|
|
|
|
|
+ // Restore the stored NodeID before the port-conflict check so a node inbound
|
|
|
|
|
+ // stays scoped to its own node (the payload's nodeId is unreliable, often absent).
|
|
|
|
|
+ inbound.NodeID = oldInbound.NodeID
|
|
|
|
|
+
|
|
|
conflict, err := s.checkPortConflict(inbound, inbound.Id)
|
|
conflict, err := s.checkPortConflict(inbound, inbound.Id)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
return inbound, false, err
|
|
return inbound, false, err
|
|
@@ -1112,11 +1120,6 @@ func (s *InboundService) UpdateInbound(inbound *model.Inbound) (*model.Inbound,
|
|
|
return inbound, false, common.NewError(conflict.String())
|
|
return inbound, false, common.NewError(conflict.String())
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- oldInbound, err := s.GetInbound(inbound.Id)
|
|
|
|
|
- if err != nil {
|
|
|
|
|
- return inbound, false, err
|
|
|
|
|
- }
|
|
|
|
|
- inbound.NodeID = oldInbound.NodeID
|
|
|
|
|
// Capture the pre-edit protocol and routing state before oldInbound is
|
|
// Capture the pre-edit protocol and routing state before oldInbound is
|
|
|
// overwritten with the new values further down, then ensure a routed
|
|
// overwritten with the new values further down, then ensure a routed
|
|
|
// inbound keeps a stable egress port (reusing the one already stored).
|
|
// inbound keeps a stable egress port (reusing the one already stored).
|