closeSession remove session from memory
(sessionID int64, needLock bool)
| 565 | |
| 566 | // closeSession remove session from memory |
| 567 | func (p *PeerDataNodeServerImpl) cleanSession(sessionID int64, needLock bool) { |
| 568 | if needLock { |
| 569 | p.Lock() |
| 570 | defer p.Unlock() |
| 571 | } |
| 572 | |
| 573 | session := p.sessions[sessionID] |
| 574 | if session != nil { |
| 575 | delete(p.sessions, sessionID) |
| 576 | tableShardKey := tableShardPair{table: session.table, shardID: session.shardID} |
| 577 | sessionIDs := p.tableShardSessions[tableShardKey] |
| 578 | for i, sid := range sessionIDs { |
| 579 | if sid == sessionID { |
| 580 | sessionIDs = append(sessionIDs[:i], sessionIDs[i+1:]...) |
| 581 | p.tableShardSessions[tableShardKey] = sessionIDs |
| 582 | break |
| 583 | } |
| 584 | } |
| 585 | } |
| 586 | } |
| 587 | |
| 588 | // retrieve session info using session id |
| 589 | func (p *PeerDataNodeServerImpl) getSession(sessionID int64) (*sessionInfo, error) { |
no test coverage detected