ipn/localapi: close portmapper after debug

This ensures that any mappings that are created are correctly cleaned
up, instead of waiting for them to expire in the router.

Updates #7377

Signed-off-by: Andrew Dunham <andrew@du.nham.ca>
Change-Id: I436248ee7740eded6d8adae5df525e785a8f7ccb
This commit is contained in:
Andrew Dunham 2023-03-05 00:45:53 -05:00
parent f6cd24499b
commit 045f995203

View File

@ -689,6 +689,8 @@ func (h *Handler) serveDebugPortmap(w http.ResponseWriter, r *http.Request) {
} }
logf("cb: no mapping") logf("cb: no mapping")
}) })
defer c.Close()
linkMon, err := monitor.New(logger.WithPrefix(logf, "monitor: ")) linkMon, err := monitor.New(logger.WithPrefix(logf, "monitor: "))
if err != nil { if err != nil {
logf("error creating monitor: %v", err) logf("error creating monitor: %v", err)