Leave remove specified UID related session from group
(s *session.Session)
| 173 | |
| 174 | // Leave remove specified UID related session from group |
| 175 | func (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 |
| 192 | func (c *Group) LeaveAll() error { |
no test coverage detected