Rubify Socket and ServerSocket
authorKevin Clark <kclark@apache.org>
Wed, 18 Jun 2008 01:15:06 +0000 (01:15 +0000)
committerKevin Clark <kclark@apache.org>
Wed, 18 Jun 2008 01:15:06 +0000 (01:15 +0000)
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@668993 13f79535-47bb-0310-9956-ffa450edef68

lib/rb/lib/thrift/transport/socket.rb

index 88fed90..5c1c4b1 100644 (file)
@@ -30,7 +30,7 @@ module Thrift
     end
 
     def open?
-      return !@handle.nil?
+      !@handle.nil?
     end
 
     def write(str)
@@ -50,7 +50,7 @@ module Thrift
       if (data.length == 0)
         raise TransportException.new(TransportException::UNKNOWN, "Socket: Could not read #{sz} bytes from #{@host}:#{@port}")
       end
-      return data
+      data
     end
 
     def close
@@ -71,17 +71,17 @@ module Thrift
     end
 
     def accept
-      if (@handle != nil)
+      unless @handle.nil?
         sock = @handle.accept
         trans = Socket.new
         trans.set_handle(sock)
-        return trans
+        trans
       end
-      return nil
     end
 
     def close
      @handle.close unless @handle.nil?
+     @handle = nil
     end
   end
   deprecate_class! :TServerSocket => ServerSocket