Skip to content

routeSubscribeAt not closed #792

@nekohasekai

Description

@nekohasekai

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions