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

ruby-changes:38681

From: normal <ko1@a...>
Date: Thu, 4 Jun 2015 10:09:28 +0900 (JST)
Subject: [ruby-changes:38681] normal:r50762 (trunk): ext/openssl/lib/openssl/ssl.rb: use io/nonblock instead of fcntl

normal	2015-06-04 10:09:09 +0900 (Thu, 04 Jun 2015)

  New Revision: 50762

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

  Log:
    ext/openssl/lib/openssl/ssl.rb: use io/nonblock instead of fcntl
    
    [ruby-core:69382] [Feature #11190]
    
    IO#nonblock= is easier-to-read, potentially more portable, and
    avoids redundantly setting flags.

  Modified files:
    trunk/ChangeLog
    trunk/ext/openssl/lib/openssl/ssl.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 50761)
+++ ChangeLog	(revision 50762)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Jun  4 09:52:02 2015  Eric Wong  <e@8...>
+
+	* ext/openssl/lib/openssl/ssl.rb: use io/nonblock instead of fcntl
+	  [ruby-core:69382] [Feature #11190]
+
 Thu Jun  4 07:22:45 2015  Koichi Sasada  <ko1@a...>
 
 	* method.h: introduce rb_method_refined_t for refined method entry.
Index: ext/openssl/lib/openssl/ssl.rb
===================================================================
--- ext/openssl/lib/openssl/ssl.rb	(revision 50761)
+++ ext/openssl/lib/openssl/ssl.rb	(revision 50762)
@@ -15,7 +15,7 @@ https://github.com/ruby/ruby/blob/trunk/ext/openssl/lib/openssl/ssl.rb#L15
 =end
 
 require "openssl/buffering"
-require "fcntl"
+require "io/nonblock"
 
 module OpenSSL
   module SSL
@@ -126,9 +126,7 @@ module OpenSSL https://github.com/ruby/ruby/blob/trunk/ext/openssl/lib/openssl/ssl.rb#L126
 
     module Nonblock
       def initialize(*args)
-        flag = File::NONBLOCK
-        flag |= @io.fcntl(Fcntl::F_GETFL) if defined?(Fcntl::F_GETFL)
-        @io.fcntl(Fcntl::F_SETFL, flag)
+        @io.nonblock = true if @io.respond_to?(:nonblock=)
         super
       end
     end

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

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