Oops, make sure those locks are released.

This commit is contained in:
Azareal 2018-09-08 15:29:51 +10:00
parent dfc60ec214
commit e22a96f53e
1 changed files with 2 additions and 2 deletions

View File

@ -110,22 +110,22 @@ func (wsUser *WSUser) SetPageForSocket(conn *websocket.Conn, page string) {
func (wsUser *WSUser) InPage(page string) bool {
wsUser.Lock()
defer wsUser.Unlock()
for _, socket := range wsUser.Sockets {
if socket.Page == page {
return true
}
}
wsUser.Unlock()
return false
}
func (wsUser *WSUser) FinalizePage(page string, handle func()) {
wsUser.Lock()
defer wsUser.Unlock()
for _, socket := range wsUser.Sockets {
if socket.Page == page {
return
}
}
handle()
wsUser.Unlock()
}