[macruby-changes] [4204] MacRuby/trunk/lib/net/protocol.rb

source_changes at macosforge.org source_changes at macosforge.org
Fri Jun 4 17:03:42 PDT 2010


Revision: 4204
          http://trac.macosforge.org/projects/ruby/changeset/4204
Author:   martinlagardette at apple.com
Date:     2010-06-04 17:03:40 -0700 (Fri, 04 Jun 2010)
Log Message:
-----------
Revert `rbuf_fill` until we actually implement `read_nonblock` / `write_nonblock`

Modified Paths:
--------------
    MacRuby/trunk/lib/net/protocol.rb

Modified: MacRuby/trunk/lib/net/protocol.rb
===================================================================
--- MacRuby/trunk/lib/net/protocol.rb	2010-06-05 00:02:31 UTC (rev 4203)
+++ MacRuby/trunk/lib/net/protocol.rb	2010-06-05 00:03:40 UTC (rev 4204)
@@ -131,23 +131,28 @@
     BUFSIZE = 1024 * 16
 
     def rbuf_fill
-      begin
-        @rbuf << @io.read_nonblock(BUFSIZE)
-      rescue IO::WaitReadable
-        if IO.select([@io], nil, nil, @read_timeout)
-          retry
-        else
-          raise Timeout::Error
-        end
-      rescue IO::WaitWritable
-        # OpenSSL::Buffering#read_nonblock may fail with IO::WaitWritable.
-        # http://www.openssl.org/support/faq.html#PROG10
-        if IO.select(nil, [@io], nil, @read_timeout)
-          retry
-        else
-          raise Timeout::Error
-        end
-      end
+      timeout(@read_timeout) {
+        @rbuf << @io.sysread(BUFSIZE)
+      }
+      # XXX MacRuby : Until we implement read_nonblock, write_nonbloick,
+      # IO::WaitReadable and IO::WaitWritable, let's use the old method using timeout
+      # begin
+      #   @rbuf << @io.read_nonblock(BUFSIZE)
+      # rescue IO::WaitReadable
+      #   if IO.select([@io], nil, nil, @read_timeout)
+      #     retry
+      #   else
+      #     raise Timeout::Error
+      #   end
+      # rescue IO::WaitWritable
+      #   # OpenSSL::Buffering#read_nonblock may fail with IO::WaitWritable.
+      #   # http://www.openssl.org/support/faq.html#PROG10
+      #   if IO.select(nil, [@io], nil, @read_timeout)
+      #     retry
+      #   else
+      #     raise Timeout::Error
+      #   end
+      # end
     end
 
     def rbuf_consume(len)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100604/0207278a/attachment-0001.html>


More information about the macruby-changes mailing list