mirror of
https://github.com/vlang/v.git
synced 2025-09-13 22:42:26 +03:00
fmt: fix alignment of struct init fields (#22025)
This commit is contained in:
parent
99da5726db
commit
c51d30bf53
671 changed files with 18817 additions and 18787 deletions
|
@ -69,8 +69,8 @@ pub fn (mut s Server) on_message(fun SocketMessageFn) {
|
|||
pub fn (mut s Server) on_message_ref(fun SocketMessageFn2, ref voidptr) {
|
||||
s.message_callbacks << MessageEventHandler{
|
||||
handler2: fun
|
||||
ref: ref
|
||||
is_ref: true
|
||||
ref: ref
|
||||
is_ref: true
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,8 +85,8 @@ pub fn (mut s Server) on_close(fun SocketCloseFn) {
|
|||
pub fn (mut s Server) on_close_ref(fun SocketCloseFn2, ref voidptr) {
|
||||
s.close_callbacks << CloseEventHandler{
|
||||
handler2: fun
|
||||
ref: ref
|
||||
is_ref: true
|
||||
ref: ref
|
||||
is_ref: true
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,8 +101,8 @@ pub fn (mut ws Client) on_message(fun SocketMessageFn) {
|
|||
pub fn (mut ws Client) on_message_ref(fun SocketMessageFn2, ref voidptr) {
|
||||
ws.message_callbacks << MessageEventHandler{
|
||||
handler2: fun
|
||||
ref: ref
|
||||
is_ref: true
|
||||
ref: ref
|
||||
is_ref: true
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -117,8 +117,8 @@ pub fn (mut ws Client) on_error(fun SocketErrorFn) {
|
|||
pub fn (mut ws Client) on_error_ref(fun SocketErrorFn2, ref voidptr) {
|
||||
ws.error_callbacks << ErrorEventHandler{
|
||||
handler2: fun
|
||||
ref: ref
|
||||
is_ref: true
|
||||
ref: ref
|
||||
is_ref: true
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -134,8 +134,8 @@ pub fn (mut ws Client) on_open(fun SocketOpenFn) {
|
|||
pub fn (mut ws Client) on_open_ref(fun SocketOpenFn2, ref voidptr) {
|
||||
ws.open_callbacks << OpenEventHandler{
|
||||
handler2: fun
|
||||
ref: ref
|
||||
is_ref: true
|
||||
ref: ref
|
||||
is_ref: true
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -150,8 +150,8 @@ pub fn (mut ws Client) on_close(fun SocketCloseFn) {
|
|||
pub fn (mut ws Client) on_close_ref(fun SocketCloseFn2, ref voidptr) {
|
||||
ws.close_callbacks << CloseEventHandler{
|
||||
handler2: fun
|
||||
ref: ref
|
||||
is_ref: true
|
||||
ref: ref
|
||||
is_ref: true
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -90,9 +90,9 @@ fn (mut s Server) parse_client_handshake(client_handshake string, mut c Client)
|
|||
server_handshake := 'HTTP/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: ${seckey}\r\n\r\n'
|
||||
server_client := &ServerClient{
|
||||
resource_name: get_tokens[1]
|
||||
client_key: key
|
||||
client: unsafe { c }
|
||||
server: unsafe { s }
|
||||
client_key: key
|
||||
client: unsafe { c }
|
||||
server: unsafe { s }
|
||||
}
|
||||
return server_handshake, server_client
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ pub fn (mut ws Client) read_next_message() !Message {
|
|||
// Control frames can interject other frames
|
||||
// and need to be returned immediately
|
||||
msg := Message{
|
||||
opcode: OPCode(frame.opcode)
|
||||
opcode: OPCode(frame.opcode)
|
||||
payload: frame_payload.clone()
|
||||
}
|
||||
unsafe { frame_payload.free() }
|
||||
|
@ -137,7 +137,7 @@ pub fn (mut ws Client) read_next_message() !Message {
|
|||
// a fragment is allowed to have zero size payload
|
||||
if !frame.fin {
|
||||
ws.fragments << &Fragment{
|
||||
data: frame_payload.clone()
|
||||
data: frame_payload.clone()
|
||||
opcode: frame.opcode
|
||||
}
|
||||
unsafe { frame_payload.free() }
|
||||
|
@ -150,7 +150,7 @@ pub fn (mut ws Client) read_next_message() !Message {
|
|||
return err
|
||||
}
|
||||
msg := Message{
|
||||
opcode: OPCode(frame.opcode)
|
||||
opcode: OPCode(frame.opcode)
|
||||
payload: frame_payload.clone()
|
||||
}
|
||||
unsafe { frame_payload.free() }
|
||||
|
@ -167,7 +167,7 @@ pub fn (mut ws Client) read_next_message() !Message {
|
|||
opcode := ws.opcode_from_fragments()
|
||||
ws.validate_utf_8(opcode, payload)!
|
||||
msg := Message{
|
||||
opcode: opcode
|
||||
opcode: opcode
|
||||
payload: payload.clone()
|
||||
}
|
||||
unsafe {
|
||||
|
|
|
@ -92,18 +92,18 @@ pub:
|
|||
pub fn new_client(address string, opt ClientOpt) !&Client {
|
||||
uri := parse_uri(address)!
|
||||
return &Client{
|
||||
conn: unsafe { nil }
|
||||
is_server: false
|
||||
ssl_conn: ssl.new_ssl_conn()!
|
||||
is_ssl: address.starts_with('wss')
|
||||
logger: opt.logger
|
||||
uri: uri
|
||||
conn: unsafe { nil }
|
||||
is_server: false
|
||||
ssl_conn: ssl.new_ssl_conn()!
|
||||
is_ssl: address.starts_with('wss')
|
||||
logger: opt.logger
|
||||
uri: uri
|
||||
client_state: ClientState{
|
||||
state: .closed
|
||||
}
|
||||
id: rand.uuid_v4()
|
||||
header: http.new_header()
|
||||
read_timeout: opt.read_timeout
|
||||
id: rand.uuid_v4()
|
||||
header: http.new_header()
|
||||
read_timeout: opt.read_timeout
|
||||
write_timeout: opt.write_timeout
|
||||
}
|
||||
}
|
||||
|
@ -437,10 +437,10 @@ fn parse_uri(url string) !&Uri {
|
|||
}
|
||||
querystring := if v.len > 1 { '?' + v[1] } else { '' }
|
||||
return &Uri{
|
||||
url: url
|
||||
hostname: u.hostname()
|
||||
port: port
|
||||
resource: v[0]
|
||||
url: url
|
||||
hostname: u.hostname()
|
||||
port: port
|
||||
resource: v[0]
|
||||
querystring: querystring
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,9 +49,9 @@ pub:
|
|||
// new_server instance a new websocket server on provided port and route
|
||||
pub fn new_server(family net.AddrFamily, port int, route string, opt ServerOpt) &Server {
|
||||
return &Server{
|
||||
ls: unsafe { nil }
|
||||
ls: unsafe { nil }
|
||||
family: family
|
||||
port: port
|
||||
port: port
|
||||
logger: opt.logger
|
||||
}
|
||||
}
|
||||
|
@ -143,21 +143,21 @@ pub fn (mut s Server) handle_handshake(mut conn net.TcpConn, key string) !&Serve
|
|||
mut logger := &log.Log{}
|
||||
logger.set_level(.debug)
|
||||
mut c := &Client{
|
||||
is_server: true
|
||||
conn: conn
|
||||
is_ssl: false
|
||||
logger: logger
|
||||
is_server: true
|
||||
conn: conn
|
||||
is_ssl: false
|
||||
logger: logger
|
||||
client_state: ClientState{
|
||||
state: .open
|
||||
}
|
||||
last_pong_ut: time.now().unix()
|
||||
id: rand.uuid_v4()
|
||||
id: rand.uuid_v4()
|
||||
}
|
||||
mut server_client := &ServerClient{
|
||||
resource_name: 'GET'
|
||||
client_key: key
|
||||
client: unsafe { c }
|
||||
server: unsafe { &s }
|
||||
client_key: key
|
||||
client: unsafe { c }
|
||||
server: unsafe { &s }
|
||||
}
|
||||
digest := create_key_challenge_response(key)!
|
||||
handshake_response := 'HTTP/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: ${digest}\r\n\r\n'
|
||||
|
@ -218,15 +218,15 @@ fn (mut s Server) setup_callbacks(mut sc ServerClient) {
|
|||
fn (mut s Server) accept_new_client() !&Client {
|
||||
mut new_conn := s.ls.accept()!
|
||||
c := &Client{
|
||||
is_server: true
|
||||
conn: new_conn
|
||||
ssl_conn: ssl.new_ssl_conn()!
|
||||
logger: s.logger
|
||||
is_server: true
|
||||
conn: new_conn
|
||||
ssl_conn: ssl.new_ssl_conn()!
|
||||
logger: s.logger
|
||||
client_state: ClientState{
|
||||
state: .open
|
||||
}
|
||||
last_pong_ut: time.now().unix()
|
||||
id: rand.uuid_v4()
|
||||
id: rand.uuid_v4()
|
||||
}
|
||||
return c
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue