mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-13 11:53:41 +00:00
feat: direct call download api by cgo dart
This commit is contained in:
1 parent
467ada5500
commit
91dfd78b77
71 files changed
+6936
-1883
No files matched your search
+9
-6
@@ -21,6 +21,7 @@ func Start(cfg *model.StartConfig) {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
downloadCfgResult := instance.GetConfig()
|
||||
if downloadCfgResult.HasError() {
|
||||
panic(downloadCfgResult.Msg)
|
||||
@@ -52,13 +53,15 @@ func Start(cfg *model.StartConfig) {
|
||||
}
|
||||
}
|
||||
}
|
||||
startResult := instance.Start()
|
||||
if startResult.HasError() {
|
||||
panic(startResult.Msg)
|
||||
}
|
||||
fmt.Printf("Server start success on http://%s:%s\n", startResult.Data.Host, startResult.Data.Port)
|
||||
|
||||
watchExit(instance)
|
||||
|
||||
result, start, err := api.ListenHttp(cfg.DownloadConfig.Http, instance)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fmt.Printf("Server start success on http://%s:%d\n", result.Host, result.Port)
|
||||
start()
|
||||
}
|
||||
|
||||
func watchExit(instance *api.Instance) {
|
||||
@@ -67,7 +70,7 @@ func watchExit(instance *api.Instance) {
|
||||
go func() {
|
||||
sig := <-sigs
|
||||
fmt.Printf("Server is shutting down due to signal: %s\n", sig)
|
||||
instance.Stop()
|
||||
instance.Close()
|
||||
os.Exit(0)
|
||||
}()
|
||||
}
|
||||
Reference in new issue
Block a user