1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-08-31 10:20:55 +00:00

Fix 'sub' commands after 'ready'

This commit is contained in:
Kane York 2016-04-28 14:39:20 -07:00
parent 801a57a1fa
commit 822e298d5d
5 changed files with 65 additions and 49 deletions

View file

@ -174,15 +174,7 @@ func C2SReady(conn *websocket.Conn, client *ClientInfo, msg ClientMessage) (rmsg
// }
client.Mutex.Lock()
if client.MakePendingRequests != nil {
if !client.MakePendingRequests.Stop() {
// Timer already fired, GetSubscriptionBacklog() has started
rmsg.Command = SuccessCommand
return
}
}
client.PendingSubscriptionsBacklog = nil
client.MakePendingRequests = nil
client.ReadyComplete = true
client.Mutex.Unlock()
client.MsgChannelKeepalive.Add(1)
@ -204,13 +196,18 @@ func C2SSubscribe(conn *websocket.Conn, client *ClientInfo, msg ClientMessage) (
client.Mutex.Lock()
AddToSliceS(&client.CurrentChannels, channel)
if usePendingSubscrptionsBacklog {
client.PendingSubscriptionsBacklog = append(client.PendingSubscriptionsBacklog, channel)
}
client.Mutex.Unlock()
SubscribeChannel(client, channel)
if client.ReadyComplete {
client.MsgChannelKeepalive.Add(1)
go func() {
SendBacklogForChannel(client, channel)
client.MsgChannelKeepalive.Done()
}()
}
return ResponseSuccess, nil
}