From: minima Date: Fri, 11 Jan 2002 00:30:15 +0000 (+0000) Subject: try to get around differences for TCP_NODELAY for perl 5_005 and below X-Git-Tag: R_1_50~96 X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=commitdiff_plain;h=0a86c4341dfe313546f605c32959810cbf5bc288;p=spider.git try to get around differences for TCP_NODELAY for perl 5_005 and below --- diff --git a/perl/Msg.pm b/perl/Msg.pm index 5593e937..57880ed1 100644 --- a/perl/Msg.pm +++ b/perl/Msg.pm @@ -375,7 +375,11 @@ sub new_server { return $self; } -use Socket qw(IPPROTO_TCP TCP_NODELAY); +eval "use Socket qw(IPPROTO_TCP TCP_NODELAY)"; +if ($@) { + sub IPPROTO_TCP {6;} + sub TCP_NODELAY {1;}; +} sub nolinger { @@ -390,7 +394,7 @@ sub nolinger setsockopt($conn->{sock}, SOL_SOCKET, SO_LINGER, pack("ll", 0, 0)) or confess "setsockopt linger: $!"; setsockopt($conn->{sock}, SOL_SOCKET, SO_KEEPALIVE, 1) or confess "setsockopt keepalive: $!"; - setsockopt($conn->{sock}, IPPROTO_TCP, TCP_NODELAY, 1) or confess "setsockopt: $!"; + setsockopt($conn->{sock}, IPPROTO_TCP, TCP_NODELAY, 1) or confess "setsockopt: $!" unless $main::iswin; $conn->{sock}->autoflush(0); if (isdbg('sock')) {