>insecure
[ dup { [ secure? ] [ not ] } 1|| [ <secure> ] unless ] map ;
+: filter-ipv6 ( seq -- seq' )
+ ipv6-supported? [ [ ipv6? not ] filter ] unless ;
+
: listen-on ( threaded-server -- addrspecs )
[ secure>> >secure ] [ insecure>> >insecure ] bi append
- [ resolve-host ] map concat ;
+ [ resolve-host ] map concat filter-ipv6 ;
: accepted-connection ( remote local -- )
[
alien.strings io.binary accessors destructors classes byte-arrays
parser alien.c-types math.parser splitting grouping math assocs
summary system vocabs.loader combinators present fry vocabs.parser
-classes.struct alien.data strings ;
+classes.struct alien.data strings io.encodings.binary ;
IN: io.sockets
<< {
[ invalid-local-address ] if
] dip with-variable ; inline
+: ipv6-supported? ( -- ? )
+ [ "::1" 0 <inet6> binary <server> dispose t ] [ drop f ] recover ;
+
{
{ [ os unix? ] [ "io.sockets.unix" require ] }
{ [ os windows? ] [ "io.sockets.windows" require ] }