Closed novel045 closed 9 months ago
func (n *Node) findOrCreateSession(sid int64, gateAddr string) (*session.Session, error) { n.mu.RLock() s, found := n.sessions[sid] n.mu.RUnlock() if !found { conns, err := n.rpcClient.getConnPool(gateAddr) if err != nil { return nil, err } ac := &acceptor{ sid: sid, gateClient: clusterpb.NewMemberClient(conns.Get()), rpcHandler: n.handler.remoteProcess, gateAddr: gateAddr, } s = session.New(ac) ac.session = s n.mu.Lock() n.sessions[sid] = s n.mu.Unlock() } return s, nil }
Question
传递的sessionId在当前节点找不到的时候, 新增会话对象同时当前的会话对象又使用新的sessionId,但是又使用旧的sessionid 进行节点会话池注册,这个是处于什么考虑呢?