mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-08-08 23:30:53 +00:00
Use UnixNano() so we have millis
This commit is contained in:
parent
71f08f3c53
commit
c63a93679b
1 changed files with 11 additions and 10 deletions
|
@ -105,13 +105,14 @@ func C2SHello(conn *websocket.Conn, client *ClientInfo, msg ClientMessage) (rmsg
|
||||||
SubscribeGlobal(client)
|
SubscribeGlobal(client)
|
||||||
SubscribeDefaults(client)
|
SubscribeDefaults(client)
|
||||||
|
|
||||||
if client.Version.After(lastVersionWithoutReplyWithServerTime) {
|
if client.Version.After(&lastVersionWithoutReplyWithServerTime) {
|
||||||
|
jsTime := float64(time.Now().UnixNano()) / (1000 * 1000)
|
||||||
return ClientMessage{
|
return ClientMessage{
|
||||||
Arguments: []interface{}{
|
Arguments: []interface{}{
|
||||||
client.ClientID.String(),
|
client.ClientID.String(),
|
||||||
time.Now().Unix(),
|
jsTime,
|
||||||
},
|
},
|
||||||
}
|
}, nil
|
||||||
} else {
|
} else {
|
||||||
return ClientMessage{
|
return ClientMessage{
|
||||||
Arguments: client.ClientID.String(),
|
Arguments: client.ClientID.String(),
|
||||||
|
@ -120,10 +121,10 @@ func C2SHello(conn *websocket.Conn, client *ClientInfo, msg ClientMessage) (rmsg
|
||||||
}
|
}
|
||||||
|
|
||||||
func C2SReady(conn *websocket.Conn, client *ClientInfo, msg ClientMessage) (rmsg ClientMessage, err error) {
|
func C2SReady(conn *websocket.Conn, client *ClientInfo, msg ClientMessage) (rmsg ClientMessage, err error) {
|
||||||
disconnectAt, err := msg.ArgumentsAsInt()
|
// disconnectAt, err := msg.ArgumentsAsInt()
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
|
|
||||||
client.Mutex.Lock()
|
client.Mutex.Lock()
|
||||||
if client.MakePendingRequests != nil {
|
if client.MakePendingRequests != nil {
|
||||||
|
@ -141,9 +142,9 @@ func C2SReady(conn *websocket.Conn, client *ClientInfo, msg ClientMessage) (rmsg
|
||||||
go func() {
|
go func() {
|
||||||
client.MessageChannel <- ClientMessage{MessageID: msg.MessageID, Command: SuccessCommand}
|
client.MessageChannel <- ClientMessage{MessageID: msg.MessageID, Command: SuccessCommand}
|
||||||
SendBacklogForNewClient(client)
|
SendBacklogForNewClient(client)
|
||||||
if disconnectAt != 0 {
|
// if disconnectAt != 0 {
|
||||||
SendTimedBacklogMessages(client, time.Unix(disconnectAt, 0))
|
// SendTimedBacklogMessages(client, time.Unix(disconnectAt, 0))
|
||||||
}
|
// }
|
||||||
client.MsgChannelKeepalive.Done()
|
client.MsgChannelKeepalive.Done()
|
||||||
}()
|
}()
|
||||||
return ClientMessage{Command: AsyncResponseCommand}, nil
|
return ClientMessage{Command: AsyncResponseCommand}, nil
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue