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

net/openssl/websocket: implement io.Writer (#8980)

This commit is contained in:
zakuro
2021-02-27 17:29:18 +09:00
committed by GitHub
parent f67bff1696
commit d0a64f2da7
7 changed files with 32 additions and 29 deletions

View File

@ -170,7 +170,7 @@ pub fn (mut c StreamConn) close() ? {
}
// write_ptr blocks and attempts to write all data
pub fn (mut c StreamConn) write_ptr(b byteptr, len int) ? {
pub fn (mut c StreamConn) write_ptr(b byteptr, len int) ?int {
$if trace_unix ? {
eprintln(
'>>> StreamConn.write_ptr | c.sock.handle: $c.sock.handle | b: ${ptr_str(b)} len: $len |\n' +
@ -194,17 +194,17 @@ pub fn (mut c StreamConn) write_ptr(b byteptr, len int) ? {
}
total_sent += sent
}
return total_sent
}
return none
}
// write blocks and attempts to write all data
pub fn (mut c StreamConn) write(bytes []byte) ? {
pub fn (mut c StreamConn) write(bytes []byte) ?int {
return c.write_ptr(bytes.data, bytes.len)
}
// write_str blocks and attempts to write all data
pub fn (mut c StreamConn) write_str(s string) ? {
pub fn (mut c StreamConn) write_str(s string) ?int {
return c.write_ptr(s.str, s.len)
}