From 694afa65a5b0a5f3ecd849037c3fa2de83ae8121 Mon Sep 17 00:00:00 2001 From: Thomas Rudin Date: Mon, 6 May 2019 19:24:59 +0200 Subject: [PATCH] use tcp v4 --- server/web/serve.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/web/serve.go b/server/web/serve.go index 71bea21..5996b06 100644 --- a/server/web/serve.go +++ b/server/web/serve.go @@ -4,6 +4,7 @@ import ( "mapserver/app" "mapserver/bundle" "mapserver/vfs" + "net" "net/http" "strconv" @@ -51,7 +52,12 @@ func Serve(ctx *app.App) { mux.Handle("/api/mapblock/", &MapblockHandler{ctx: ctx}) } - err := http.ListenAndServe(":"+strconv.Itoa(ctx.Config.Port), mux) + server := &http.Server{Handler: mux} + l, err := net.Listen("tcp4", ":"+strconv.Itoa(ctx.Config.Port)) + if err != nil { + panic(err) + } + err = server.Serve(l) if err != nil { panic(err) }