mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
Make write_nonblock available under SSL (#1274)
* Stub out write_nonblock with write * Support (and discard) keywords used * Handle keywords to read_nonblock as well * Thing -> think
This commit is contained in:
parent
482ea5a24a
commit
7cd363f799
1 changed files with 16 additions and 1 deletions
|
@ -36,7 +36,9 @@ module Puma
|
|||
output
|
||||
end
|
||||
|
||||
def read_nonblock(size)
|
||||
def read_nonblock(size, *_)
|
||||
# *_ is to deal with keyword args that were added
|
||||
# at some point (and being used in the wild)
|
||||
while true
|
||||
output = engine_read_all
|
||||
return output if output
|
||||
|
@ -77,6 +79,19 @@ module Puma
|
|||
alias_method :syswrite, :write
|
||||
alias_method :<<, :write
|
||||
|
||||
# This is a temporary fix to deal with websockets code using
|
||||
# write_nonblock. The problem with implementing it properly
|
||||
# is that it means we'd have to have the ability to rewind
|
||||
# an engine because after we write+extract, the socket
|
||||
# write_nonblock call might raise an exception and later
|
||||
# code would pass the same data in, but the engine would think
|
||||
# it had already written the data in. So for the time being
|
||||
# (and since write blocking is quite rare), go ahead and actually
|
||||
# block in write_nonblock.
|
||||
def write_nonblock(data, *_)
|
||||
write data
|
||||
end
|
||||
|
||||
def flush
|
||||
@socket.flush
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue