1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

ci: run vfmt over websocket_client.v and websocket_server.v

This commit is contained in:
Delyan Angelov
2020-12-28 07:13:25 +02:00
parent bd67b647f2
commit b65353794c
2 changed files with 25 additions and 27 deletions

View File

@ -20,7 +20,8 @@ pub:
port int // port used as listen to incoming connections
is_ssl bool // true if secure connection (not supported yet on server)
pub mut:
ping_interval int = 30 // interval for sending ping to clients (seconds)
ping_interval int = 30
// interval for sending ping to clients (seconds)
state State // current state of connection
}
@ -57,9 +58,7 @@ pub fn (mut s Server) listen() ? {
s.set_state(.open)
go s.handle_ping()
for {
mut c := s.accept_new_client() or {
continue
}
mut c := s.accept_new_client() or { continue }
go s.serve_client(mut c)
}
s.logger.info('websocket server: end listen on port $s.port')
@ -88,9 +87,7 @@ fn (mut s Server) handle_ping() {
}
if (time.now().unix - c.client.last_pong_ut) > s.ping_interval * 2 {
clients_to_remove << c.client.id
c.client.close(1000, 'no pong received') or {
continue
}
c.client.close(1000, 'no pong received') or { continue }
}
}
}