mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-11-02 11:15:03 +03:00
fix(node): remove a client a pushed inbound disables from the running core
UpdateInbound applies a master's push to the node's running core as the difference between the stored and the pushed user sets, but both sets dropped clients whose traffic row is off, and the same transaction had already stored the pushed flags on those rows. A client the push disabled therefore vanished from both sets, no RemoveUser was sent and the node's Xray kept serving it. The running set is now taken from the stored row's own enable flags, so the client the push switches off is removed from every handler, including a second inbound sharing the same traffic row.
This commit is contained in:
@@ -2281,7 +2281,7 @@ func (s *InboundService) UpdateInbound(inbound *model.Inbound) (*model.Inbound,
|
||||
}
|
||||
if runtimeInbound != nil && running.Enable {
|
||||
// Unbuildable means unknown running state: the rebuild below covers it.
|
||||
runningInbound, _ = s.buildInboundForLocalRuntime(tx, &running)
|
||||
runningInbound, _ = s.buildRunningInbound(tx, &running)
|
||||
}
|
||||
postCommitApply = func() {
|
||||
if runningInbound != nil && applyInboundUserOps(rt, runningInbound, runtimeInbound) {
|
||||
@@ -2438,6 +2438,16 @@ func (s *InboundService) buildInboundForNodePush(tx *gorm.DB, inbound *model.Inb
|
||||
// Strips disabled clients on top of the node payload. Safe only because the
|
||||
// target here is an in-memory Xray/mtg config, not another panel's database.
|
||||
func (s *InboundService) buildInboundForLocalRuntime(tx *gorm.DB, inbound *model.Inbound) (*model.Inbound, error) {
|
||||
return s.stripDisabledClients(tx, inbound, true)
|
||||
}
|
||||
|
||||
// The stored row as its handler holds it: its own enable flags only. A stats row
|
||||
// is shared by every inbound of the client and already holds what this push stored.
|
||||
func (s *InboundService) buildRunningInbound(tx *gorm.DB, stored *model.Inbound) (*model.Inbound, error) {
|
||||
return s.stripDisabledClients(tx, stored, false)
|
||||
}
|
||||
|
||||
func (s *InboundService) stripDisabledClients(tx *gorm.DB, inbound *model.Inbound, byStatsRow bool) (*model.Inbound, error) {
|
||||
built, err := s.buildInboundForNodePush(tx, inbound)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -2459,9 +2469,11 @@ func (s *InboundService) buildInboundForLocalRuntime(tx *gorm.DB, inbound *model
|
||||
emails = append(emails, email)
|
||||
}
|
||||
}
|
||||
disabled, err := trafficDisabledEmails(tx, emails)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
var disabled map[string]struct{}
|
||||
if byStatsRow {
|
||||
if disabled, err = trafficDisabledEmails(tx, emails); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
trafficIDs := make(map[string]int)
|
||||
|
||||
Reference in New Issue
Block a user