Oops, make sure those locks are released.
This commit is contained in:
parent
dfc60ec214
commit
e22a96f53e
|
@ -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()
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue