diff options
Diffstat (limited to 'lib/yahns/wbuf_str.rb')
-rw-r--r-- | lib/yahns/wbuf_str.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/yahns/wbuf_str.rb b/lib/yahns/wbuf_str.rb new file mode 100644 index 0000000..414f3d5 --- /dev/null +++ b/lib/yahns/wbuf_str.rb @@ -0,0 +1,24 @@ +# -*- encoding: binary -*- +# Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> et. al. +# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) +require_relative 'wbuf_common' + +class Yahns::WbufStr # :nodoc: + include Yahns::WbufCommon + + def initialize(str, next_state) + @str = str + @next = next_state # :check_client_connection, :http_100_response + end + + def wbuf_flush(client) + case rv = client.kgio_trywrite(@str) + when String + @str = rv + when :wait_writable, :wait_readable + return rv + when nil + return @next + end while true + end +end |