io.sockets.windows.tests: plugs the socket leaks (#1104)

db4
Björn Lindqvist 2014-11-12 20:48:33 +01:00 committed by John Benediktsson
parent 0f59f314f5
commit bbab41ade4
1 changed files with 11 additions and 8 deletions

View File

@ -1,5 +1,5 @@
USING: accessors continuations io.sockets io.sockets.windows kernel sequences tools.test
urls windows.winsock ;
USING: accessors continuations destructors io.sockets io.sockets.windows
kernel sequences tools.test urls windows.winsock ;
IN: io.sockets.windows.tests
: google-socket ( -- socket )
@ -7,14 +7,17 @@ IN: io.sockets.windows.tests
SOCK_STREAM open-socket ;
{ } [
google-socket
{ FIONBIO FIONREAD } [
google-socket swap execute( -- x )
[ 1 set-ioctl-socket ] [ 0 set-ioctl-socket ] 2bi
] each drop
google-socket [
swap execute( -- x )
[ 1 set-ioctl-socket ] [ 0 set-ioctl-socket ] 2bi
] with-disposal
] each
] unit-test
{ t } [
[ google-socket 1337 -8 set-ioctl-socket ]
[ [ winsock-exception? ] [ n>> 10045 = ] bi and ] recover
google-socket [
[ 1337 -8 set-ioctl-socket ]
[ [ winsock-exception? ] [ n>> 10045 = ] bi and ] recover
] with-disposal
] unit-test