Skip Menu |

This queue is for tickets about the IO-Socket-IP CPAN distribution.

Report information
The Basics
Id: 112334
Status: resolved
Priority: 0/
Queue: IO-Socket-IP

People
Owner: Nobody in particular
Requestors: oleg [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: (no value)
Fixed in: 0.38



Subject: Should always restore blocking mode
When IO::Socket::IP connects with timeout it sets socket to non-blocking mode. But on some type of errors it will not return it to previous mode: https://metacpan.org/source/PEVANS/IO-Socket-IP-0.37/lib/IO/Socket/IP.pm#L688 Let's imagine we have host with several ip addresses and some unknown error will occure. So for next address connection will be made as socket was set non-blocking by user. But user expects blocking socket. This will produce some kind of errors. Please fix this.
On Wed Feb 24 07:08:56 2016, OLEG wrote: Show quoted text
> Please fix this.
Done -- Paul Evans
Subject: rt112334.patch
=== modified file 'lib/IO/Socket/IP.pm' --- lib/IO/Socket/IP.pm 2016-08-02 16:24:19 +0000 +++ lib/IO/Socket/IP.pm 2016-08-02 16:27:43 +0000 @@ -719,6 +719,7 @@ } elsif( not( $err == EINPROGRESS or $err == EWOULDBLOCK ) ) { # Failed for some other reason + $self->blocking( $was_blocking ); return undef; } elsif( !$was_blocking ) { @@ -728,6 +729,7 @@ my $vec = ''; vec( $vec, $self->fileno, 1 ) = 1; if( !select( undef, $vec, $vec, $timeout ) ) { + $self->blocking( $was_blocking ); $! = ETIMEDOUT; return undef; }