From 00e2d4287071ac1832bce3f928d429e74a028f53 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Tue, 18 Nov 2014 14:35:32 -0600 Subject: [PATCH] util: LoggedHTTPServe uses its own mux for use as a HTTP status server --- util/loghttp.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/util/loghttp.go b/util/loghttp.go index ce6f1ef5..399750aa 100644 --- a/util/loghttp.go +++ b/util/loghttp.go @@ -7,7 +7,7 @@ import ( _ "net/http/pprof" ) -func LoggedHTTPServe(addr string) { +func LoggedHTTPServe(addr string) *http.ServeMux { if addr == "" { addr = "localhost:6061" } @@ -27,11 +27,15 @@ func LoggedHTTPServe(addr string) { log.Fatalf("error creating http conn: %#v", err) } log.Printf("starting http server on http://%s", conn.Addr()) + mux := http.NewServeMux() go func() { defer conn.Close() - err = (&http.Server{}).Serve(conn) + err = (&http.Server{ + Handler: mux, + }).Serve(conn) if err != nil { log.Fatalf("error serving http: %s", err) } }() + return mux } -- 2.44.0