Open PatrickHuang888 opened 1 month ago
func (h *Headscale) newMapSession( ctx context.Context, req tailcfg.MapRequest, w http.ResponseWriter, node *types.Node, ) *mapSession { // here passed node to print functions in init warnf, infof, tracef, errf := logPollFunc(req, node) return &mapSession{ node: node, // Loggers warnf: warnf, infof: infof, tracef: tracef, errf: errf, } ... func (m *mapSession) serveLongPoll() { for { case update, ok := <-m.ch: // later override the node reference m.node, err = m.h.db.GetNodeByID(m.node.ID) switch update.Type { case types.StateFullUpdate: // actually print old node not the m.node m.tracef("Sending Full MapResponse") } }
maybe tracef reference to pointer of m.node ? not quit sure
func logPollFunc( mapRequest tailcfg.MapRequest, node **types.Node, ) mapSession:= &mapSession{ node: node, } warnf, infof, tracef, errf := logPollFunc(req, &mapSession.node) mapSession.warnf = warnf mapSession.infof = infof mapSession.tracef = tracef mapSession.errf = errf return mapSession
and is there any memory leak as tracef reference a unused node?
just read the code
- OS: ubuntu - Headscale version: branch main
No response
Is this a support request?
Is there an existing issue for this?
Current Behavior
Expected Behavior
maybe tracef reference to pointer of m.node ? not quit sure
and is there any memory leak as tracef reference a unused node?
Steps To Reproduce
just read the code
Environment
Runtime environment
Anything else?
No response