net: simplify TcpListener.accept, use `C.accept(l.sock.handle, 0, 0)`, since we do not care about the local address of the accepted connection
parent
716cb17aea
commit
9b43713ec5
|
@ -239,16 +239,10 @@ pub fn (mut l TcpListener) accept() ?&TcpConn {
|
||||||
$if trace_tcp ? {
|
$if trace_tcp ? {
|
||||||
eprintln(' TcpListener.accept | l.sock.handle: ${l.sock.handle:6}')
|
eprintln(' TcpListener.accept | l.sock.handle: ${l.sock.handle:6}')
|
||||||
}
|
}
|
||||||
addr := Addr{
|
mut new_handle := C.accept(l.sock.handle, 0, 0)
|
||||||
addr: AddrData{
|
|
||||||
Ip6: Ip6{}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
size := sizeof(Addr)
|
|
||||||
mut new_handle := C.accept(l.sock.handle, voidptr(&addr), &size)
|
|
||||||
if new_handle <= 0 {
|
if new_handle <= 0 {
|
||||||
l.wait_for_accept() ?
|
l.wait_for_accept() ?
|
||||||
new_handle = C.accept(l.sock.handle, voidptr(&addr), &size)
|
new_handle = C.accept(l.sock.handle, 0, 0)
|
||||||
if new_handle == -1 || new_handle == 0 {
|
if new_handle == -1 || new_handle == 0 {
|
||||||
return error('accept failed')
|
return error('accept failed')
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue