summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2000-02-23 02:08:19 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2000-02-23 02:08:19 +0000
commitdb33da1c366cee030aa4a06b47a9f66846361e94 (patch)
tree205a8aad15f32b307a87c5aeb693c778ac564c6f /ext
parent0c634585ef35014b7459d1eb5dff6f0b3ef8f646 (diff)
downloadperl-db33da1c366cee030aa4a06b47a9f66846361e94.tar.gz
Trying to connect to an already open socket may give EISCONN.
p4raw-id: //depot/cfgperl@5218
Diffstat (limited to 'ext')
-rw-r--r--ext/IO/lib/IO/Socket.pm15
1 files changed, 12 insertions, 3 deletions
diff --git a/ext/IO/lib/IO/Socket.pm b/ext/IO/lib/IO/Socket.pm
index 79820fe65d..4197eaa3c1 100644
--- a/ext/IO/lib/IO/Socket.pm
+++ b/ext/IO/lib/IO/Socket.pm
@@ -106,7 +106,7 @@ sub connect {
$blocking = $sock->blocking(0) if $timeout;
if (!connect($sock, $addr)) {
- if ($timeout && exists(&IO::EINPROGRESS) && ($! == &IO::EINPROGRESS)) {
+ if ($timeout && exists &IO::EINPROGRESS && ($! == &IO::EINPROGRESS)) {
require IO::Select;
my $sel = new IO::Select $sock;
@@ -116,8 +116,17 @@ sub connect {
$@ = "connect: timeout";
}
elsif(!connect($sock,$addr)) {
- $err = $!;
- $@ = "connect: $!";
+ if (exists &Errno::EISCONN && ($! == &Errno::EISCONN)) {
+ # Some systems (e.g. Digital UNIX/Tru64) fail to
+ # re-connect() to an already open socket and set
+ # errno to EISCONN (Socket is already connected)
+ # for such an attempt.
+ $err = 0;
+ } else {
+ # But in other cases, there is no redemption.
+ $err = $!;
+ $@ = "connect: $!";
+ }
}
}
else {