mirror of
https://github.com/wyx2685/V2bX.git
synced 2026-02-04 04:30:08 +00:00
add config watch
This commit is contained in:
19
core/core.go
19
core/core.go
@@ -167,6 +167,23 @@ func (p *Core) Start() error {
|
||||
func (p *Core) Close() {
|
||||
p.access.Lock()
|
||||
defer p.access.Unlock()
|
||||
p.Server.Close()
|
||||
p.ihm = nil
|
||||
p.ohm = nil
|
||||
p.shm = nil
|
||||
p.dispatcher = nil
|
||||
err := p.Server.Close()
|
||||
if err != nil {
|
||||
log.Panicf("failed to close xray core: %s", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (p *Core) Restart(v2bXConfig *conf.Conf) error {
|
||||
p.Close()
|
||||
p.Server = getCore(v2bXConfig)
|
||||
err := p.Start()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user