fix(deps): update module github.com/caddyserver/certmagic to v0.25.1 - autoclosed #63
@@ -3,6 +3,7 @@ package interaction
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"log"
|
"log"
|
||||||
|
"sync"
|
||||||
"tunnel_pls/internal/config"
|
"tunnel_pls/internal/config"
|
||||||
"tunnel_pls/internal/random"
|
"tunnel_pls/internal/random"
|
||||||
"tunnel_pls/session/slug"
|
"tunnel_pls/session/slug"
|
||||||
@@ -52,6 +53,7 @@ type interaction struct {
|
|||||||
ctx context.Context
|
ctx context.Context
|
||||||
cancel context.CancelFunc
|
cancel context.CancelFunc
|
||||||
mode types.InteractiveMode
|
mode types.InteractiveMode
|
||||||
|
programMu sync.Mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *interaction) SetMode(m types.InteractiveMode) {
|
func (i *interaction) SetMode(m types.InteractiveMode) {
|
||||||
@@ -103,6 +105,10 @@ func (i *interaction) Stop() {
|
|||||||
if i.cancel != nil {
|
if i.cancel != nil {
|
||||||
i.cancel()
|
i.cancel()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
i.programMu.Lock()
|
||||||
|
defer i.programMu.Unlock()
|
||||||
|
|
||||||
if i.program != nil {
|
if i.program != nil {
|
||||||
i.program.Kill()
|
i.program.Kill()
|
||||||
i.program = nil
|
i.program = nil
|
||||||
@@ -238,6 +244,7 @@ func (i *interaction) Start() {
|
|||||||
help: help.New(),
|
help: help.New(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
i.programMu.Lock()
|
||||||
i.program = tea.NewProgram(
|
i.program = tea.NewProgram(
|
||||||
m,
|
m,
|
||||||
tea.WithInput(i.channel),
|
tea.WithInput(i.channel),
|
||||||
@@ -248,13 +255,20 @@ func (i *interaction) Start() {
|
|||||||
tea.WithoutSignalHandler(),
|
tea.WithoutSignalHandler(),
|
||||||
tea.WithFPS(30),
|
tea.WithFPS(30),
|
||||||
)
|
)
|
||||||
|
i.programMu.Unlock()
|
||||||
|
|
||||||
_, err := i.program.Run()
|
_, err := i.program.Run()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Cannot close tea: %s \n", err)
|
log.Printf("Cannot close tea: %s \n", err)
|
||||||
}
|
}
|
||||||
i.program.Kill()
|
|
||||||
i.program = nil
|
i.programMu.Lock()
|
||||||
|
if i.program != nil {
|
||||||
|
i.program.Kill()
|
||||||
|
i.program = nil
|
||||||
|
}
|
||||||
|
i.programMu.Unlock()
|
||||||
|
|
||||||
if i.closeFunc != nil {
|
if i.closeFunc != nil {
|
||||||
_ = i.closeFunc()
|
_ = i.closeFunc()
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user