diff options
author | Dave Mitchell <davem@fdisolutions.com> | 2003-02-18 21:45:45 +0000 |
---|---|---|
committer | hv <hv@crypt.org> | 2003-02-19 00:00:41 +0000 |
commit | 3c83a670ef5b88bf7bcdc0857c28022b13bf2106 (patch) | |
tree | 1b3a3e2cf5aca209d52331d5e501bace51516e34 | |
parent | b9ed3dd7480deabece83966d48086615c68bcb04 (diff) | |
download | perl-3c83a670ef5b88bf7bcdc0857c28022b13bf2106.tar.gz |
Blocking option ignored
Date: Tue, 18 Feb 2003 21:45:45 +0000
Message-ID: <20030218214545.C18547@fdgroup.com>
and tests for the same:
From: Dave Mitchell <davem@fdgroup.com>
Date: Wed, 19 Feb 2003 00:42:01 +0000
Message-ID: <20030219004201.F18547@fdgroup.com>
p4raw-id: //depot/perl@18748
-rw-r--r-- | ext/IO/lib/IO/Socket/INET.pm | 7 | ||||
-rwxr-xr-x | ext/IO/lib/IO/t/io_sock.t | 16 |
2 files changed, 18 insertions, 5 deletions
diff --git a/ext/IO/lib/IO/Socket/INET.pm b/ext/IO/lib/IO/Socket/INET.pm index f59c810bb4..7d1c94dedd 100644 --- a/ext/IO/lib/IO/Socket/INET.pm +++ b/ext/IO/lib/IO/Socket/INET.pm @@ -129,8 +129,6 @@ sub configure { or return _error($sock, $!, $@); } - $sock->blocking($arg->{Blocking}) if defined $arg->{Blocking}; - $proto ||= (getprotobyname('tcp'))[2]; my $pname = (getprotobynumber($proto))[0]; @@ -149,6 +147,11 @@ sub configure { $sock->socket(AF_INET, $type, $proto) or return _error($sock, $!, "$!"); + if (defined $arg->{Blocking}) { + defined $sock->blocking($arg->{Blocking}) + or return _error($sock, $!, "$!"); + } + if ($arg->{Reuse} || $arg->{ReuseAddr}) { $sock->sockopt(SO_REUSEADDR,1) or return _error($sock, $!, "$!"); diff --git a/ext/IO/lib/IO/t/io_sock.t b/ext/IO/lib/IO/t/io_sock.t index c4bfcc41cd..d91db55eca 100755 --- a/ext/IO/lib/IO/t/io_sock.t +++ b/ext/IO/lib/IO/t/io_sock.t @@ -29,7 +29,7 @@ BEGIN { } $| = 1; -print "1..20\n"; +print "1..22\n"; eval { $SIG{ALRM} = sub { die; }; @@ -220,12 +220,12 @@ if ( $^O eq 'qnx' ) { # local @data; if( !open( SRC, "< $0")) { - print "not ok 15 - $!"; + print "not ok 15 - $!\n"; } else { @data = <SRC>; close( SRC); + print "ok 15\n"; } -print "ok 15\n"; ### TEST 16 ### Start the server @@ -336,6 +336,7 @@ if( $server_pid) { $sock = undef; } $listen->close; + exit 0; } else { @@ -345,3 +346,12 @@ if( $server_pid) { die; } +# test Blocking option in constructor + +$sock = IO::Socket::INET->new(Blocking => 0) + or print "not "; +print "ok 21\n"; + +my $status = $sock->blocking; +print "not " unless defined $status && !$status; +print "ok 22\n"; |