MCPcopy
hub / github.com/lonng/nano / Leave

Method Leave

group.go:175–189  ·  view source on GitHub ↗

Leave remove specified UID related session from group

(s *session.Session)

Source from the content-addressed store, hash-verified

173
174// Leave remove specified UID related session from group
175func (c *Group) Leave(s *session.Session) error {
176 if c.isClosed() {
177 return ErrClosedGroup
178 }
179
180 if env.Debug {
181 log.Println(fmt.Sprintf("Remove session from group %s, UID=%d", c.name, s.UID()))
182 }
183
184 c.mu.Lock()
185 defer c.mu.Unlock()
186
187 delete(c.sessions, s.ID())
188 return nil
189}
190
191// LeaveAll clear all sessions in the group
192func (c *Group) LeaveAll() error {

Callers 4

AfterInitMethod · 0.80
InitMethod · 0.80
userDisconnectedMethod · 0.80
userDisconnectedMethod · 0.80

Calls 4

isClosedMethod · 0.95
PrintlnMethod · 0.80
UIDMethod · 0.80
IDMethod · 0.45

Tested by

no test coverage detected