Skip to content

Commit

Permalink
feat: fix nil user
Browse files Browse the repository at this point in the history
  • Loading branch information
chenqinghe committed Oct 14, 2022
1 parent 2108f0d commit f68a711
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,11 @@ func (m *Manager) StoreConn(c Conn) (*Session, error) {
m.conns[sess.Id()] = sess
m.mu.Unlock()

m.ulock.Lock()
m.users[sess.User().Id()] = sess
m.ulock.Unlock()
if user != nil {
m.ulock.Lock()
m.users[user.Id()] = sess
m.ulock.Unlock()
}

logrus.Debug("accept a new connection, remote addr:" + c.RemoteAddr().String())

Expand Down

0 comments on commit f68a711

Please sign in to comment.