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 { func (wsUser *WSUser) InPage(page string) bool {
wsUser.Lock() wsUser.Lock()
defer wsUser.Unlock()
for _, socket := range wsUser.Sockets { for _, socket := range wsUser.Sockets {
if socket.Page == page { if socket.Page == page {
return true return true
} }
} }
wsUser.Unlock()
return false return false
} }
func (wsUser *WSUser) FinalizePage(page string, handle func()) { func (wsUser *WSUser) FinalizePage(page string, handle func()) {
wsUser.Lock() wsUser.Lock()
defer wsUser.Unlock()
for _, socket := range wsUser.Sockets { for _, socket := range wsUser.Sockets {
if socket.Page == page { if socket.Page == page {
return return
} }
} }
handle() handle()
wsUser.Unlock()
} }