time: update unix time acces, fix issues related to deviating unix times (#21293)

This commit is contained in:
Turiiya 2024-04-16 23:33:37 +02:00 committed by GitHub
parent 9d117fc3a0
commit 1363cc85fd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
55 changed files with 251 additions and 193 deletions

View file

@ -108,7 +108,7 @@ fn (mut s Server) handle_ping() {
}
clients_to_remove << c.client.id
}
if (time.now().unix - c.client.last_pong_ut) > s.get_ping_interval() * 2 {
if (time.now().unix() - c.client.last_pong_ut) > s.get_ping_interval() * 2 {
clients_to_remove << c.client.id
c.client.close(1000, 'no pong received') or { continue }
}
@ -150,7 +150,7 @@ pub fn (mut s Server) handle_handshake(mut conn net.TcpConn, key string) !&Serve
client_state: ClientState{
state: .open
}
last_pong_ut: time.now().unix
last_pong_ut: time.now().unix()
id: rand.uuid_v4()
}
mut server_client := &ServerClient{
@ -225,7 +225,7 @@ fn (mut s Server) accept_new_client() !&Client {
client_state: ClientState{
state: .open
}
last_pong_ut: time.now().unix
last_pong_ut: time.now().unix()
id: rand.uuid_v4()
}
return c