<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1061,6 +1061,21 @@ class MemCache
 
       io = MemCache::BufferedIO.new(sock)
       io.read_timeout = timeout
+      # Getting reports from several customers, including 37signals,
+      # that the non-blocking timeouts in 1.7.5 don't seem to be reliable.
+      # It can't hurt to set the underlying socket timeout also, if possible.
+      if timeout
+        secs = Integer(timeout)
+        usecs = Integer((timeout - secs) * 1_000_000)
+        optval = [secs, usecs].pack(&quot;l_2&quot;)
+        begin
+          io.setsockopt Socket::SOL_SOCKET, Socket::SO_RCVTIMEO, optval
+          io.setsockopt Socket::SOL_SOCKET, Socket::SO_SNDTIMEO, optval
+        rescue Exception =&gt; ex
+          # Solaris, for one, does not like/support socket timeouts.
+          @logger.info &quot;[memcache-client] Unable to use raw socket timeouts: #{ex.class.name}: #{ex.message}&quot; if @logger
+        end
+      end
       io
     end
 </diff>
      <filename>lib/memcache.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>7df4e8c5c16571a13c7987b7f6dd6156b843725c</id>
    </parent>
  </parents>
  <author>
    <name>Mike Perham</name>
    <email>mperham@gmail.com</email>
  </author>
  <url>http://github.com/mperham/memcache-client/commit/74b2599f0c42487fe5d02e9410a271691e2832f2</url>
  <id>74b2599f0c42487fe5d02e9410a271691e2832f2</id>
  <committed-date>2009-10-29T16:49:00-07:00</committed-date>
  <authored-date>2009-10-29T16:49:00-07:00</authored-date>
  <message>Add back in raw socket timeout as a backup to the non-blocking IO.select
timeout.</message>
  <tree>730f86baa9ead567de2f7876dc08b54014a17bf9</tree>
  <committer>
    <name>Mike Perham</name>
    <email>mperham@gmail.com</email>
  </committer>
</commit>
