mirror of
https://github.com/vlang/v.git
synced 2025-09-14 06:52:36 +03:00
net, net.http: fix C.FD_ISSET declaration (#19594)
This commit is contained in:
parent
092358fd24
commit
07390ef4c4
8 changed files with 10 additions and 15 deletions
|
@ -109,7 +109,7 @@ fn C.FD_ZERO(fdset &C.fd_set)
|
|||
|
||||
fn C.FD_SET(fd int, fdset &C.fd_set)
|
||||
|
||||
fn C.FD_ISSET(fd int, fdset &C.fd_set) bool
|
||||
fn C.FD_ISSET(fd int, fdset &C.fd_set) int
|
||||
|
||||
fn C.inet_pton(family AddrFamily, saddr &char, addr voidptr) int
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ fn @select(handle int, test Select, timeout time.Duration) !bool {
|
|||
}
|
||||
}
|
||||
|
||||
return C.FD_ISSET(handle, &set)
|
||||
return C.FD_ISSET(handle, &set) != 0
|
||||
}
|
||||
|
||||
[inline]
|
||||
|
@ -108,7 +108,7 @@ fn select_deadline(handle int, test Select, deadline time.Time) !bool {
|
|||
}
|
||||
|
||||
// Deadline elapsed
|
||||
return false
|
||||
return err_timed_out
|
||||
}
|
||||
|
||||
// wait_for_common wraps the common wait code
|
||||
|
|
|
@ -193,6 +193,7 @@ fn (req &Request) read_all_from_client_connection(r &net.TcpConn) ![]u8 {
|
|||
mut read := i64(0)
|
||||
mut b := []u8{len: 32768}
|
||||
for {
|
||||
r.wait_for_read()!
|
||||
old_read := read
|
||||
new_read := r.read(mut b[read..]) or { break }
|
||||
read += new_read
|
||||
|
|
|
@ -580,5 +580,5 @@ fn @select(handle int, test Select, timeout time.Duration) !bool {
|
|||
$if trace_ssl ? {
|
||||
eprintln('${@METHOD} ---> res: ${res}')
|
||||
}
|
||||
return res
|
||||
return res != 0
|
||||
}
|
||||
|
|
|
@ -460,5 +460,5 @@ fn @select(handle int, test Select, timeout time.Duration) !bool {
|
|||
$if trace_ssl ? {
|
||||
eprintln('${@METHOD} ---> res: ${res}')
|
||||
}
|
||||
return res
|
||||
return res != 0
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
module net
|
||||
|
||||
import time
|
||||
import io
|
||||
import strings
|
||||
|
||||
pub const (
|
||||
|
@ -147,12 +146,7 @@ pub fn (c TcpConn) read_ptr(buf_ptr &u8, len int) !int {
|
|||
}
|
||||
|
||||
pub fn (c TcpConn) read(mut buf []u8) !int {
|
||||
return c.read_ptr(buf.data, buf.len) or {
|
||||
return io.NotExpected{
|
||||
cause: 'unexpected error in `read_ptr` function'
|
||||
code: -1
|
||||
}
|
||||
}
|
||||
return c.read_ptr(buf.data, buf.len)!
|
||||
}
|
||||
|
||||
pub fn (mut c TcpConn) read_deadline() !time.Time {
|
||||
|
|
|
@ -57,7 +57,7 @@ fn @select(handle int, test Select, timeout time.Duration) !bool {
|
|||
}
|
||||
}
|
||||
|
||||
return C.FD_ISSET(handle, &set)
|
||||
return C.FD_ISSET(handle, &set) != 0
|
||||
}
|
||||
|
||||
// wait_for_common wraps the common wait code
|
||||
|
|
|
@ -74,9 +74,9 @@ fn (mut pv Picoev) poll_once(max_wait int) int {
|
|||
if target.loop_id == pv.loop.id {
|
||||
// vfmt off
|
||||
read_events := (
|
||||
(if C.FD_ISSET(target.fd, &readfds) { picoev_read } else { 0 })
|
||||
(if C.FD_ISSET(target.fd, &readfds) != 0 { picoev_read } else { 0 })
|
||||
|
|
||||
(if C.FD_ISSET(target.fd, &writefds) { picoev_write } else { 0 })
|
||||
(if C.FD_ISSET(target.fd, &writefds) != 0 { picoev_write } else { 0 })
|
||||
)
|
||||
// vfmt on
|
||||
if read_events != 0 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue