repo.or.cz
/
rainbows.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
history
|
raw
|
HEAD
ev_core: reuse buffer to avoid GC thrashing
[rainbows.git]
/
lib
/
rainbows
/
event_machine
/
response_chunk_pipe.rb
blob
af9393a8040c6b14136b708d1d07ad30b3534f2d
1
# -*- encoding: binary -*-
2
# :enddoc:
3
module Rainbows::EventMachine::ResponseChunkPipe
4
include Rainbows::EventMachine::ResponsePipe
5
6
def unbind
7
@client.write("0\r\n\r\n")
8
super
9
end
10
11
def notify_readable
12
begin
13
data = @io.read_nonblock(16384, RBUF)
14
@client.write("#{data.size.to_s(16)}\r\n")
15
@client.write(data)
16
@client.write("\r\n")
17
rescue Errno::EINTR
18
rescue Errno::EAGAIN
19
return
20
rescue EOFError
21
detach
22
return
23
end while true
24
end
25
end