Fix a bug with Perl's TSocket and THttpClient.
The underlying Perl library expects timeouts in seconds, but the
documentation for the Thrift classes says the should be in milliseconds.
This changes divides timeouts by 1000 to make that the case.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665585 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/perl/lib/Thrift/HttpClient.pm b/lib/perl/lib/Thrift/HttpClient.pm
index 9f79838..f8a583d 100644
--- a/lib/perl/lib/Thrift/HttpClient.pm
+++ b/lib/perl/lib/Thrift/HttpClient.pm
@@ -164,7 +164,7 @@
{
my $self = shift;
- my $ua = LWP::UserAgent->new('timeout' => $self->{sendTimeout},
+ my $ua = LWP::UserAgent->new('timeout' => ($self->{sendTimeout} / 1000),
'agent' => 'Perl/THttpClient'
);
$ua->default_header('Accept' => 'application/x-thrift');
diff --git a/lib/perl/lib/Thrift/Socket.pm b/lib/perl/lib/Thrift/Socket.pm
index 83daf4b..740e048 100644
--- a/lib/perl/lib/Thrift/Socket.pm
+++ b/lib/perl/lib/Thrift/Socket.pm
@@ -139,7 +139,7 @@
while (1) {
#check for timeout
- my @sockets = $self->{handle}->can_read( $self->{recvTimeout} );
+ my @sockets = $self->{handle}->can_read( $self->{recvTimeout} / 1000 );
if(@sockets == 0){
die new Thrift::TException('TSocket: timed out reading '.$len.' bytes from '.
@@ -179,7 +179,7 @@
my $len = shift;
#check for timeout
- my @sockets = $self->{handle}->can_read( $self->{sendTimeout} );
+ my @sockets = $self->{handle}->can_read( $self->{sendTimeout} / 1000 );
if(@sockets == 0){
die new Thrift::TException('TSocket: timed out reading '.$len.' bytes from '.
@@ -217,7 +217,7 @@
#check for timeout
- my @sockets = $self->{handle}->can_write( $self->{recvTimeout} );
+ my @sockets = $self->{handle}->can_write( $self->{recvTimeout} / 1000 );
if(@sockets == 0){
die new Thrift::TException('TSocket: timed out writing to bytes from '.