mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-08-03 16:38:31 +00:00
Better standards compliance with codes
This commit is contained in:
parent
6a5bcdca4a
commit
de6e671bdb
2 changed files with 8 additions and 5 deletions
|
@ -204,7 +204,7 @@ var CloseRebalance = websocket.CloseError{Code: websocket.CloseGoingAway, Text:
|
|||
var CloseGotBinaryMessage = websocket.CloseError{Code: websocket.CloseUnsupportedData, Text: "got binary packet"}
|
||||
|
||||
// CloseTimedOut is the termination reason when the client fails to send or respond to ping frames.
|
||||
var CloseTimedOut = websocket.CloseError{Code: websocket.CloseNoStatusReceived, Text: "no ping replies for 5 minutes"}
|
||||
var CloseTimedOut = websocket.CloseError{Code: 3003, Text: "no ping replies for 5 minutes"}
|
||||
|
||||
// CloseTooManyBufferedMessages is the termination reason when the sending thread buffers too many messages.
|
||||
var CloseTooManyBufferedMessages = websocket.CloseError{Code: websocket.CloseMessageTooBig, Text: "too many pending messages"}
|
||||
|
@ -216,7 +216,7 @@ var CloseFirstMessageNotHello = websocket.CloseError{
|
|||
}
|
||||
|
||||
var CloseNonUTF8Data = websocket.CloseError{
|
||||
Code: 4001,
|
||||
Code: websocket.CloseUnsupportedData,
|
||||
Text: "Non UTF8 data recieved. Network corruption likely.",
|
||||
}
|
||||
|
||||
|
|
|
@ -96,13 +96,17 @@ func DumpBacklogData() {
|
|||
// This will only send data for CacheTypePersistent and CacheTypeLastOnly because those do not involve timestamps.
|
||||
func SendBacklogForNewClient(client *ClientInfo) {
|
||||
client.Mutex.Lock() // reading CurrentChannels
|
||||
curChannels := make([]string, len(client.CurrentChannels))
|
||||
copy(curChannels, client.CurrentChannels)
|
||||
client.Mutex.Unlock()
|
||||
|
||||
PersistentLSMLock.RLock()
|
||||
for _, cmd := range GetCommandsOfType(PushCommandCacheInfo{CacheTypePersistent, MsgTargetTypeChat}) {
|
||||
chanMap := CachedLastMessages[cmd]
|
||||
if chanMap == nil {
|
||||
continue
|
||||
}
|
||||
for _, channel := range client.CurrentChannels {
|
||||
for _, channel := range curChannels {
|
||||
msg, ok := chanMap[channel]
|
||||
if ok {
|
||||
msg := ClientMessage{MessageID: -1, Command: cmd, origArguments: msg.Data}
|
||||
|
@ -119,7 +123,7 @@ func SendBacklogForNewClient(client *ClientInfo) {
|
|||
if chanMap == nil {
|
||||
continue
|
||||
}
|
||||
for _, channel := range client.CurrentChannels {
|
||||
for _, channel := range curChannels {
|
||||
msg, ok := chanMap[channel]
|
||||
if ok {
|
||||
msg := ClientMessage{MessageID: -1, Command: cmd, origArguments: msg.Data}
|
||||
|
@ -129,7 +133,6 @@ func SendBacklogForNewClient(client *ClientInfo) {
|
|||
}
|
||||
}
|
||||
CachedLSMLock.RUnlock()
|
||||
client.Mutex.Unlock()
|
||||
}
|
||||
|
||||
// insertionSort implements insertion sort.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue