MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / getSession

Method getSession

rpc/mux/pool.go:135–151  ·  view source on GitHub ↗
(id proto.NodeID)

Source from the content-addressed store, hash-verified

133}
134
135func (p *SessionPool) getSession(id proto.NodeID) (sess *Session, loaded bool) {
136 // NO Blocking operation in this function
137 p.Lock()
138 defer p.Unlock()
139 sess, exist := p.sessions[id]
140 if exist {
141 //log.WithField("node", id).Debug("load session for target node")
142 loaded = true
143 } else {
144 // new session
145 sess = &Session{
146 target: id,
147 }
148 p.sessions[id] = sess
149 }
150 return
151}
152
153// Get returns existing session to the node, if not exist try best to create one.
154func (p *SessionPool) Get(id proto.NodeID) (conn rpc.Client, err error) {

Callers 3

GetMethod · 0.95
TestNewPersistentCallerFunction · 0.80

Calls

no outgoing calls

Tested by 2

TestNewPersistentCallerFunction · 0.64