summaryrefslogtreecommitdiff
path: root/lib/std/listen+posixy.myr
diff options
context:
space:
mode:
Diffstat (limited to 'lib/std/listen+posixy.myr')
-rw-r--r--lib/std/listen+posixy.myr11
1 files changed, 3 insertions, 8 deletions
diff --git a/lib/std/listen+posixy.myr b/lib/std/listen+posixy.myr
index be4456d..7f4b35b 100644
--- a/lib/std/listen+posixy.myr
+++ b/lib/std/listen+posixy.myr
@@ -17,7 +17,6 @@ use "utf"
pkg std =
const announce : (ds : byte[:] -> result(fd, byte[:]))
- const listen : (sock : fd -> result(fd, byte[:]))
const accept : (lfd : fd -> result(fd, byte[:]))
;;
@@ -80,6 +79,9 @@ const announcesock = {proto, str
if sys.bind(sock, sa, sz) < 0
-> `Err "failed to bind socket"
;;
+ if sys.listen((sock : sys.fd), 10) < 0
+ -> `Err "unable to listen on socket"
+ ;;
-> `Ok (sock : fd)
}
@@ -110,13 +112,6 @@ const announceunix = {path
}
-const listen = {sock : std.fd -> result(fd, byte[:])
- if sys.listen((sock : sys.fd), 10) < 0
- -> `Err "unable to listen on socket"
- ;;
- -> `Ok (sys.dup((sock : sys.fd)) : fd)
-}
-
const accept = {lfd
var sa : sys.sockaddr_storage
var len : sys.size