From: David Reiss Date: Thu, 27 Mar 2008 19:45:24 +0000 (+0000) Subject: Fix a bug with Perl's TSocket and THttpClient. X-Git-Tag: 0.2.0~887 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=7502e0be13ca6748cb501de0c6c4eaaeba6ec499;p=common%2Fthrift.git 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 9f79838c..f8a583da 100644 --- a/lib/perl/lib/Thrift/HttpClient.pm +++ b/lib/perl/lib/Thrift/HttpClient.pm @@ -164,7 +164,7 @@ sub flush { 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 83daf4be..740e0483 100644 --- a/lib/perl/lib/Thrift/Socket.pm +++ b/lib/perl/lib/Thrift/Socket.pm @@ -139,7 +139,7 @@ sub readAll 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 @@ sub read 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 @@ sub write #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 '.