mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-11-02 11:15:03 +03:00
fix(inbounds): delete an inbound's dependent rows on every delete path
The node sync's sweep of an inbound the node stopped reporting deleted the inbound but left its host rows, and the depleted-clients delete left its sub-balancer references. SQLite hands a freed inbound id out again once the table empties, so a node's host overrides could bind to a new inbound it never hosted and point that inbound's subscribers at an address, port and TLS settings the node chose. delInbound's cleanup moves into deleteInboundRow (detach clients, delete the inbound, its host rows and its sub-balancer references), which the sweep and the depleted-clients delete now call as well.
This commit is contained in:
@@ -961,13 +961,7 @@ func (s *InboundService) DelDepletedClients(id int) (err error) {
|
||||
}
|
||||
if len(newClients) == 0 {
|
||||
deletedInbounds = append(deletedInbounds, *inbound)
|
||||
if err := s.clientService.DetachInbound(tx, inbound.Id); err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := database.DeleteHosts(tx, "inbound_id = ?", inbound.Id); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := tx.Delete(model.Inbound{}, inbound.Id).Error; err != nil {
|
||||
if err := s.deleteInboundRow(tx, inbound.Id); err != nil {
|
||||
return err
|
||||
}
|
||||
if inbound.NodeID != nil {
|
||||
|
||||
Reference in New Issue
Block a user