mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-01 06:54:47 +03:00
07e41c8287
A config the core cannot bind must never replace one that works: the new core exits at start and the watchdog then restarts it every two seconds with every inbound down. The guard only looked for two inbounds of the same config sharing a socket, so an inbound saved on a port some other process holds went through: the hot apply failed, the restart followed, and the panel looped on "address already in use" until the inbound was removed. Before replacing a running core, bind each socket the new config adds the way the core will (it sets SO_REUSEPORT on every listener) and refuse the config when the address is in use. Sockets the running config already serves are the core's own and are not probed. The refusal is reported like the existing bind conflict, on the status page and in the log, and the next tick applies the config once the port is free. Run on a panel with the real core: with the port held, the core kept its PID and the other inbound kept serving with no failed probe in 60 s; the inbound came up by hot apply on the first tick after the port was released. A listen address the host does not have, or a port the panel may not bind, is still left to the core's own error.