@@ -3,7 +3,6 @@ package main
33import (
44 "archive/zip"
55 "compress/gzip"
6- "context"
76 _ "embed"
87 "encoding/json"
98 "errors"
@@ -18,14 +17,17 @@ import (
1817 "net/http"
1918 "net/url"
2019 "os"
21- "os/signal"
2220 "path/filepath"
2321 "sort"
2422 "strconv"
2523 "strings"
26- "time"
2724)
2825
26+ type rpcCall struct {
27+ Call string `json:"call"`
28+ Args []string `json:"args"`
29+ }
30+
2931var rootPath = ""
3032var handler http.Handler
3133
@@ -244,14 +246,15 @@ func main() {
244246 check (err )
245247 server := & http.Server {Addr : * host + ":" + * port , Handler : handler }
246248
247- go func () {
248- sigchan := make (chan os.Signal , 1 )
249- signal .Notify (sigchan , os .Interrupt )
250- <- sigchan
251- ctx , cancel := context .WithTimeout (context .Background (), 5 * time .Second )
252- defer cancel ()
253- server .Shutdown (ctx )
254- }()
249+ // clean shutdown - used only for coverage test
250+ // go func() {
251+ // sigchan := make(chan os.Signal, 1)
252+ // signal.Notify(sigchan, os.Interrupt)
253+ // <-sigchan
254+ // ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
255+ // defer cancel()
256+ // server.Shutdown(ctx)
257+ // }()
255258
256259 if ! * ro {
257260 http .HandleFunc (* extraPath + "rpc" , rpc )
@@ -260,6 +263,7 @@ func main() {
260263 http .HandleFunc (* extraPath + "zip" , zipRPC )
261264 http .HandleFunc ("/" , doContent )
262265 handler = http .StripPrefix (* extraPath , http .FileServer (http .Dir (rootPath )))
266+
263267 fmt .Printf ("Gossa starting on directory %s\n Listening on http://%s:%s%s\n " , rootPath , * host , * port , * extraPath )
264268 if err = server .ListenAndServe (); err != http .ErrServerClosed {
265269 check (err )
0 commit comments