From ec50b892e5d3bc6f585780ebbbf071d489b2c3ae Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 4 May 2010 14:56:44 -0700 Subject: revactor: match IO behavior for readpartial wrapper IO#readpartial on zero bytes will always return an empty string, so ensure the emulator for Revactor does that as well. --- lib/rainbows/revactor.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/rainbows/revactor.rb b/lib/rainbows/revactor.rb index 21fa72f..b1f0d9b 100644 --- a/lib/rainbows/revactor.rb +++ b/lib/rainbows/revactor.rb @@ -149,6 +149,7 @@ module Rainbows # Revactor socket reads always return an unspecified amount, # sometimes too much def readpartial(length, dst = "") + return dst if length == 0 # always check and return from the userspace buffer first rbuf.size > 0 and return dst.replace(rbuf.read(length)) -- cgit v1.2.3-24-ge0c7