normal destructuring with one line changed
This commit is contained in:
10
std/net.zr
10
std/net.zr
@@ -22,7 +22,7 @@ func net.listen[host: str, port: i64] : i64, bool
|
||||
_builtin_syscall(SYS_close, s)
|
||||
return -1, false
|
||||
|
||||
~packed_host, ok := net.resolve(host)
|
||||
packed_host, ok := net.resolve(host)
|
||||
if !ok
|
||||
return -1, false
|
||||
|
||||
@@ -44,7 +44,7 @@ func net.connect[host: str, port: i64] : i64, bool
|
||||
if s < 0
|
||||
return -1, false
|
||||
|
||||
~packed_host, ok := net.resolve(host)
|
||||
packed_host, ok := net.resolve(host)
|
||||
if !ok
|
||||
return -1, false
|
||||
|
||||
@@ -106,7 +106,7 @@ func net.UDPSocket.close_and_free[s: net.UDPSocket] : void
|
||||
func net.create_udp_client[host: str, port: i64] : net.UDPSocket, bool
|
||||
s := new* net.UDPSocket
|
||||
|
||||
~packed_host, ok := net.resolve(host)
|
||||
packed_host, ok := net.resolve(host)
|
||||
if !ok
|
||||
return 0 as net.UDPSocket, false
|
||||
|
||||
@@ -120,7 +120,7 @@ func net.create_udp_client[host: str, port: i64] : net.UDPSocket, bool
|
||||
return s, true
|
||||
|
||||
func net.create_udp_server[host: str, port: i64] : net.UDPSocket, bool
|
||||
~s, ok := net.create_udp_client(host, port)
|
||||
s, ok := net.create_udp_client(host, port)
|
||||
if !ok
|
||||
return 0 as net.UDPSocket, false
|
||||
|
||||
@@ -172,7 +172,7 @@ func net.resolve[domain: str] : i64, bool
|
||||
query := net.build_dns_query(domain, DNS_TYPE_A)
|
||||
|
||||
// TODO: this probably shouldnt be hardcoded
|
||||
~s, ok := net.create_udp_client("1.1.1.1", 53)
|
||||
s, ok := net.create_udp_client("1.1.1.1", 53)
|
||||
if !ok
|
||||
query->free()
|
||||
return -1, false
|
||||
|
||||
Reference in New Issue
Block a user