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

ruby-changes:44770

From: shugo <ko1@a...>
Date: Sat, 19 Nov 2016 20:01:58 +0900 (JST)
Subject: [ruby-changes:44770] shugo:r56843 (trunk): Use Socket instead of TCPSocket/TCPServer.

shugo	2016-11-19 20:01:55 +0900 (Sat, 19 Nov 2016)

  New Revision: 56843

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

  Log:
    Use Socket instead of TCPSocket/TCPServer.

  Modified files:
    trunk/lib/net/ftp.rb
Index: lib/net/ftp.rb
===================================================================
--- lib/net/ftp.rb	(revision 56842)
+++ lib/net/ftp.rb	(revision 56843)
@@ -311,7 +311,7 @@ module Net https://github.com/ruby/ruby/blob/trunk/lib/net/ftp.rb#L311
     # Constructs a socket with +host+ and +port+.
     #
     # If SOCKSSocket is defined and the environment (ENV) defines
-    # SOCKS_SERVER, then a SOCKSSocket is returned, else a TCPSocket is
+    # SOCKS_SERVER, then a SOCKSSocket is returned, else a Socket is
     # returned.
     def open_socket(host, port) # :nodoc:
       return Timeout.timeout(@open_timeout, Net::OpenTimeout) {
@@ -319,7 +319,7 @@ module Net https://github.com/ruby/ruby/blob/trunk/lib/net/ftp.rb#L319
           @passive = true
           sock = SOCKSSocket.open(host, port)
         else
-          sock = TCPSocket.open(host, port)
+          sock = Socket.tcp(host, port)
         end
       }
     end
@@ -507,7 +507,7 @@ module Net https://github.com/ruby/ruby/blob/trunk/lib/net/ftp.rb#L507
 
     # Constructs a TCPServer socket
     def makeport # :nodoc:
-      TCPServer.open(@bare_sock.local_address.ip_address, 0)
+      Addrinfo.tcp(@bare_sock.local_address.ip_address, 0).listen
     end
     private :makeport
 
@@ -557,7 +557,7 @@ module Net https://github.com/ruby/ruby/blob/trunk/lib/net/ftp.rb#L557
           if !resp.start_with?("1")
             raise FTPReplyError, resp
           end
-          conn = sock.accept
+          conn, peeraddr = sock.accept
           sock.shutdown(Socket::SHUT_WR) rescue nil
           sock.read rescue nil
         ensure

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

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