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

ruby-changes:51036

From: normal <ko1@a...>
Date: Mon, 23 Apr 2018 06:21:12 +0900 (JST)
Subject: [ruby-changes:51036] normal:r63243 (trunk): net/imap: set SO_KEEPALIVE on TCP sockets

normal	2018-04-23 06:21:06 +0900 (Mon, 23 Apr 2018)

  New Revision: 63243

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

  Log:
    net/imap: set SO_KEEPALIVE on TCP sockets
    
    Otherwise connections (commonly on IDLE, but it could be any
    command) may never receive notifications of link errors.
    
    [ruby-core:86628] [Feature #14703]

  Modified files:
    trunk/lib/net/imap.rb
Index: lib/net/imap.rb
===================================================================
--- lib/net/imap.rb	(revision 63242)
+++ lib/net/imap.rb	(revision 63243)
@@ -1129,7 +1129,9 @@ module Net https://github.com/ruby/ruby/blob/trunk/lib/net/imap.rb#L1129
     end
 
     def tcp_socket(host, port)
-      Socket.tcp(host, port, :connect_timeout => @open_timeout)
+      s = Socket.tcp(host, port, :connect_timeout => @open_timeout)
+      s.setsockopt(:SOL_SOCKET, :SO_KEEPALIVE, true)
+      s
     rescue Errno::ETIMEDOUT
       raise Net::OpenTimeout, "Timeout to open TCP connection to " +
         "#{host}:#{port} (exceeds #{@open_timeout} seconds)"

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

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