Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

routeSubscribeAt not closed #792

Closed
nekohasekai opened this issue Jul 31, 2022 · 0 comments · Fixed by #793
Closed

routeSubscribeAt not closed #792

nekohasekai opened this issue Jul 31, 2022 · 0 comments · Fixed by #793

Comments

@nekohasekai
Copy link
Contributor

code:

package main

import (
	"net/http"
	_ "net/http/pprof"
	"time"

	"github.com/vishvananda/netlink"
)

func main() {
	ch := make(chan netlink.RouteUpdate, 2)
	done := make(chan struct{})
	netlink.RouteSubscribe(ch, done)
	time.Sleep(time.Second)
	close(done)
	println("closed")
	http.ListenAndServe(":8080", nil)
}

documentation says: close the 'done' chan to stop subscription.

pprof result:

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant