io.sockets.windows.tests: plugs the socket leaks (#1104)
parent
0f59f314f5
commit
bbab41ade4
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue