[前][次][番号順一覧][スレッド一覧]

ruby-changes:41736

From: nobu <ko1@a...>
Date: Fri, 12 Feb 2016 11:49:55 +0900 (JST)
Subject: [ruby-changes:41736] nobu:r53810 (trunk): net/ftp.rb: NullSocket#closed?

nobu	2016-02-12 11:50:09 +0900 (Fri, 12 Feb 2016)

  New Revision: 53810

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53810

  Log:
    net/ftp.rb: NullSocket#closed?
    
    * net/ftp.rb: add NullSocket#closed? to fix closing not opened
      connection.  [Fix GH-1232]

  Modified files:
    trunk/ChangeLog
    trunk/lib/net/ftp.rb
    trunk/test/net/ftp/test_ftp.rb
Index: test/net/ftp/test_ftp.rb
===================================================================
--- test/net/ftp/test_ftp.rb	(revision 53809)
+++ test/net/ftp/test_ftp.rb	(revision 53810)
@@ -29,6 +29,14 @@ class FTPTest < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/net/ftp/test_ftp.rb#L29
     end
   end
 
+  def test_closed_when_not_connected
+    ftp = Net::FTP.new
+    assert_equal(true, ftp.closed?)
+    assert_nothing_raised(Net::FTPConnectionError) do
+      ftp.close
+    end
+  end
+
   def test_connect_fail
     server = create_ftp_server { |sock|
       sock.print("421 Service not available, closing control connection.\r\n")
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 53809)
+++ ChangeLog	(revision 53810)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Feb 12 11:49:49 2016  Anthony Dmitriyev  <antstorm@g...>
+
+	* net/ftp.rb: add NullSocket#closed? to fix closing not opened
+	  connection.  [Fix GH-1232]
+
 Fri Feb 12 11:17:38 2016  Bogdan  <bogdanvlviv@g...>
 
 	* re.c (rb_reg_initialize_m): [DOC] fix missing right bracket.
Index: lib/net/ftp.rb
===================================================================
--- lib/net/ftp.rb	(revision 53809)
+++ lib/net/ftp.rb	(revision 53810)
@@ -1270,6 +1270,10 @@ module Net https://github.com/ruby/ruby/blob/trunk/lib/net/ftp.rb#L1270
       def read_timeout=(sec)
       end
 
+      def closed?
+        true
+      end
+
       def close
       end
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]