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

ruby-changes:44841

From: usa <ko1@a...>
Date: Mon, 28 Nov 2016 19:17:12 +0900 (JST)
Subject: [ruby-changes:44841] usa:r56914 (trunk): hide exceptions in server thread

usa	2016-11-28 19:17:03 +0900 (Mon, 28 Nov 2016)

  New Revision: 56914

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

  Log:
    hide exceptions in server thread
    
    * test/net/ftp/test_ftp.rb (test_tls_connect_timeout): sleeping to give a chance of complete of accept is a timing issue at all.  therefore, simply ignore the exception.

  Modified files:
    trunk/test/net/ftp/test_ftp.rb
Index: test/net/ftp/test_ftp.rb
===================================================================
--- test/net/ftp/test_ftp.rb	(revision 56913)
+++ test/net/ftp/test_ftp.rb	(revision 56914)
@@ -2107,10 +2107,14 @@ EOF https://github.com/ruby/ruby/blob/trunk/test/net/ftp/test_ftp.rb#L2107
       commands = []
       sock = nil
       @thread = Thread.start do
-        sock = server.accept
-        sock.print("220 (test_ftp).\r\n")
-        commands.push(sock.gets)
-        sock.print("234 AUTH success.\r\n")
+        begin
+          sock = server.accept
+          sock.print("220 (test_ftp).\r\n")
+          commands.push(sock.gets)
+          sock.print("234 AUTH success.\r\n")
+        rescue SystemCallError, IOError
+          # may be raised by broken connection
+        end
       end
       begin
         assert_raise(Net::OpenTimeout) do
@@ -2120,7 +2124,6 @@ EOF https://github.com/ruby/ruby/blob/trunk/test/net/ftp/test_ftp.rb#L2124
                        open_timeout: 0.1)
         end
       ensure
-        sleep 0.1 # give a chance to complete server.accept
         sock.close if sock
         server.close
       end

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

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