You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by ja...@apache.org on 2008/12/23 04:12:50 UTC

svn commit: r728860 - /incubator/thrift/trunk/lib/perl/lib/Thrift/Socket.pm

Author: jake
Date: Mon Dec 22 19:12:50 2008
New Revision: 728860

URL: http://svn.apache.org/viewvc?rev=728860&view=rev
Log:
THRIFT-2: check for thrift::socket handle being null

Modified:
    incubator/thrift/trunk/lib/perl/lib/Thrift/Socket.pm

Modified: incubator/thrift/trunk/lib/perl/lib/Thrift/Socket.pm
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/perl/lib/Thrift/Socket.pm?rev=728860&r1=728859&r2=728860&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/perl/lib/Thrift/Socket.pm (original)
+++ incubator/thrift/trunk/lib/perl/lib/Thrift/Socket.pm Mon Dec 22 19:12:50 2008
@@ -84,7 +84,11 @@
 {
     my $self = shift;
 
-    return $self->{handle}->handles->[0]->connected;
+    if( defined $self->{handle} ){
+        return ($self->{handle}->handles())[0]->connected;
+    }
+
+    return 0;
 }
 
 #
@@ -120,7 +124,9 @@
 {
     my $self = shift;
 
-    close( ($self->{handle}->handles())[0] );
+    if( defined $self->{handle} ){
+        close( ($self->{handle}->handles())[0] );
+    }
 }
 
 #
@@ -135,6 +141,8 @@
     my $len  = shift;
 
 
+    return unless defined $self->{handle};
+
     my $pre = "";
     while (1) {
 
@@ -178,6 +186,8 @@
     my $self = shift;
     my $len  = shift;
 
+    return unless defined $self->{handle};
+
     #check for timeout
     my @sockets = $self->{handle}->can_read( $self->{sendTimeout} / 1000 );
 
@@ -213,6 +223,8 @@
     my $buf  = shift;
 
 
+    return unless defined $self->{handle};
+
     while (length($buf) > 0) {
 
 
@@ -243,6 +255,9 @@
 sub flush
 {
     my $self = shift;
+
+    return unless defined $self->{handle};
+
     my $ret  = ($self->{handle}->handles())[0]->flush;
 }