You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucy.apache.org by Dan Markham <dm...@gmail.com> on 2011/11/15 07:49:33 UTC

[lucy-dev] [patch] for ClusterSearcher.pm

Non-Blocking for mortals.

Index: ClusterSearcher.pm
===================================================================
--- ClusterSearcher.pm  (revision 1202059)
+++ ClusterSearcher.pm  (working copy)
@@ -35,7 +35,6 @@
 
 use IO::Socket::INET;
 use IO::Select;
-use Fcntl qw( F_GETFL F_SETFL O_NONBLOCK );
 
 sub new {
     my ( $either, %args ) = @_;
@@ -54,12 +53,9 @@
         my $sock = IO::Socket::INET->new(
             PeerAddr => $shard,
             Proto    => 'tcp',
+            Blocking => 1,
         );
         confess("No socket: $!") unless $sock;
-        my $flags = fcntl( $sock, F_GETFL, 0 )
-            or confess "Can't get socket flags: $!";
-        fcntl( $sock, F_SETFL, $flags | O_NONBLOCK )
-            or confess "Can't set socket flags: $!";
         push @$socks, $sock;
     }



-Dan

Re: [lucy-dev] [patch] for ClusterSearcher.pm

Posted by Marvin Humphrey <ma...@rectangular.com>.
On Mon, Nov 14, 2011 at 10:49:33PM -0800, Dan Markham wrote:
> Non-Blocking for mortals.

LOL

The arg's backwards (should be Blocking => 0) -- it's the unusual case where
we need to actively turn something off to get what we want.  After that,
applied as r1202069, thanks for the improvement!

http://svn.apache.org/viewvc?view=revision&revision=1202069

Marvin Humphrey

> Index: ClusterSearcher.pm
> ===================================================================
> --- ClusterSearcher.pm  (revision 1202059)
> +++ ClusterSearcher.pm  (working copy)
> @@ -35,7 +35,6 @@
>  
>  use IO::Socket::INET;
>  use IO::Select;
> -use Fcntl qw( F_GETFL F_SETFL O_NONBLOCK );
>  
>  sub new {
>      my ( $either, %args ) = @_;
> @@ -54,12 +53,9 @@
>          my $sock = IO::Socket::INET->new(
>              PeerAddr => $shard,
>              Proto    => 'tcp',
> +            Blocking => 1,
>          );
>          confess("No socket: $!") unless $sock;
> -        my $flags = fcntl( $sock, F_GETFL, 0 )
> -            or confess "Can't get socket flags: $!";
> -        fcntl( $sock, F_SETFL, $flags | O_NONBLOCK )
> -            or confess "Can't set socket flags: $!";
>          push @$socks, $sock;
>      }
> 
> 
> 
> -Dan