fix: clean-up cancel function

This commit is contained in:
Siyuan 2025-11-05 15:23:53 +00:00
parent d6d113e253
commit 1097deeaf8
1 changed files with 3 additions and 0 deletions

View File

@ -141,6 +141,7 @@ func (ps *PublicIPState) Start() {
if ps.timer != nil { if ps.timer != nil {
ps.timer.Stop() ps.timer.Stop()
} }
if ps.cancel != nil { if ps.cancel != nil {
ps.cancel() ps.cancel()
} }
@ -159,7 +160,9 @@ func (ps *PublicIPState) Stop() {
if ps.cancel != nil { if ps.cancel != nil {
ps.cancel() ps.cancel()
ps.cancel = nil
} }
if ps.timer != nil { if ps.timer != nil {
ps.timer.Stop() ps.timer.Stop()
ps.timer = nil ps.timer = nil