diff options
| author | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2022-06-20 20:14:32 -0700 |
|---|---|---|
| committer | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2022-06-20 20:14:32 -0700 |
| commit | 7cd900d61edbd6d322db3cecb913adf574389320 (patch) | |
| tree | 7da8ac3658fa4b6204330f1f9c980428b6a6fdc5 /cmd | |
| parent | bb1e98842e35b3affaf94971e78c86f8b9547928 (diff) | |
Add initial support for resource and info forks
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/mobius-hotline-server/main.go | 21 | ||||
| -rw-r--r-- | cmd/mobius-hotline-server/mobius/config/config.yaml | 1 |
2 files changed, 19 insertions, 3 deletions
diff --git a/cmd/mobius-hotline-server/main.go b/cmd/mobius-hotline-server/main.go index 2f914c4..bf41da1 100644 --- a/cmd/mobius-hotline-server/main.go +++ b/cmd/mobius-hotline-server/main.go @@ -29,7 +29,22 @@ const ( func main() { rand.Seed(time.Now().UnixNano()) - ctx, cancelRoot := context.WithCancel(context.Background()) + ctx, cancel := context.WithCancel(context.Background()) + + // TODO: implement graceful shutdown by closing context + // c := make(chan os.Signal, 1) + // signal.Notify(c, os.Interrupt) + // defer func() { + // signal.Stop(c) + // cancel() + // }() + // go func() { + // select { + // case <-c: + // cancel() + // case <-ctx.Done(): + // } + // }() basePort := flag.Int("bind", defaultPort, "Bind address and port") statsPort := flag.String("stats-port", "", "Enable stats HTTP endpoint on address and port") @@ -80,7 +95,7 @@ func main() { logger.Fatalw("Configuration directory not found", "path", configDir) } - srv, err := hotline.NewServer(*configDir, "", *basePort, logger, &hotline.OSFileStore{}) + srv, err := hotline.NewServer(*configDir, *basePort, logger, &hotline.OSFileStore{}) if err != nil { logger.Fatal(err) } @@ -99,7 +114,7 @@ func main() { } // Serve Hotline requests until program exit - logger.Fatal(srv.ListenAndServe(ctx, cancelRoot)) + logger.Fatal(srv.ListenAndServe(ctx, cancel)) } type statHandler struct { diff --git a/cmd/mobius-hotline-server/mobius/config/config.yaml b/cmd/mobius-hotline-server/mobius/config/config.yaml index a7a3ad9..380c39a 100644 --- a/cmd/mobius-hotline-server/mobius/config/config.yaml +++ b/cmd/mobius-hotline-server/mobius/config/config.yaml @@ -11,3 +11,4 @@ NewsDateFormat: "" MaxDownloads: 0 MaxDownloadsPerClient: 0 MaxConnectionsPerIP: 0 +PreserveResourceForks: true |