# -*- encoding: binary -*- # Copyright (C) 2016 all contributors # License: GPL-3.0+ # frozen_string_literal: true require_relative 'wbuf' # This is only used for "proxy_buffering: false" class Yahns::WbufLite < Yahns::Wbuf # :nodoc: attr_reader :busy def initialize(req_res) super(nil, :ignore) @req_res = req_res end def wbuf_write(client, buf) super rescue @req_res = @req_res.close if @req_res raise end def wbuf_flush(client) super rescue @req_res = @req_res.close if @req_res raise end # called by Yahns::HttpClient#step_write def wbuf_close(client) wbuf_abort # resume reading when @blocked is empty if @req_res client.hijack_cleanup Thread.current[:yahns_queue].queue_mod(@req_res, Yahns::Queue::QEV_RD) end :ignore rescue @req_res = @req_res.close if @req_res raise end end