Don't try to use ipv6 addresses if an OS can't bind to them
parent
8bc3c09050
commit
140aa80379
|
@ -87,9 +87,12 @@ M: f (>insecure) ;
|
|||
>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 -- )
|
||||
[
|
||||
|
|
|
@ -6,7 +6,7 @@ arrays io.encodings io.ports io.streams.duplex io.encodings.ascii
|
|||
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
|
||||
|
||||
<< {
|
||||
|
@ -380,6 +380,9 @@ M: invalid-local-address summary
|
|||
[ 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 ] }
|
||||
|
|
Loading…
Reference in New Issue