Permalink
Browse files

Maybe I should run tests before committing...

  • Loading branch information...
1 parent 48549a3 commit 4bb432217bef0760e4500bb9fd3729dc9616bf60 @loganb committed Feb 28, 2012
Showing with 12 additions and 7 deletions.
  1. +12 −7 lib/tapestry/io.rb
View
19 lib/tapestry/io.rb
@@ -27,14 +27,19 @@ def readline(sep = $/)
end
def read(len, buffer = nil)
- #Truncate the supplied buffer if there is one
- buffer.clear if buffer
- #First drain as much as possible out of the io buffer
+ #Seed buffer variable if it is nil
tmp = read_buf.read(len)
- buffer = buffer ? buffer << tmp : tmp
- len -= tmp.length
+ if buffer
+ #Truncate the supplied buffer if there is one
+ buffer.clear
+ buffer << tmp
+ else
+ buffer = tmp
+ end
+ len -= buffer.length
+
return buffer if len == 0
-
+
#now read from the file handle until full
begin
read_buf.read_from(io)
@@ -58,7 +63,7 @@ def write_nonblock(str)
def write(str)
ret = write_nonblock(str)
- wait_until_write
+ write_barrier
ret
end

0 comments on commit 4bb4322

Please sign in to comment.