From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS43350 77.247.176.0/21 X-Spam-Status: No, score=-1.9 required=3.0 tests=AWL,BAYES_00,URIBL_BLOCKED shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: yahns-public@yhbt.net Received: from 80x24.org (chomsky.torservers.net [77.247.181.162]) by dcvr.yhbt.net (Postfix) with ESMTP id 7AD9D1F83E for ; Sat, 20 Dec 2014 04:11:41 +0000 (UTC) From: Eric Wong To: yahns-public@yhbt.net Subject: [PATCH] http_client: implement as a module instead of class Date: Sat, 20 Dec 2014 04:11:40 +0000 Message-Id: <1419048700-32075-1-git-send-email-e@80x24.org> X-Mailer: git-send-email 2.2.0 List-Id: This allows us to more easilly override and invoke super via other included modules. --- lib/yahns/acceptor.rb | 2 +- lib/yahns/http_client.rb | 2 +- lib/yahns/rack.rb | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/yahns/acceptor.rb b/lib/yahns/acceptor.rb index cd9e055..3e67aba 100644 --- a/lib/yahns/acceptor.rb +++ b/lib/yahns/acceptor.rb @@ -43,7 +43,7 @@ module Yahns::Acceptor # :nodoc: queue = client_class.queue t = Thread.current accept_flags = Kgio::SOCK_NONBLOCK | Kgio::SOCK_CLOEXEC - qev_flags = client_class.superclass::QEV_FLAGS + qev_flags = client_class.const_get(:QEV_FLAGS) begin # We want the accept/accept4 syscall to be _blocking_ # so it can distribute work evenly between processes diff --git a/lib/yahns/http_client.rb b/lib/yahns/http_client.rb index a294511..371182e 100644 --- a/lib/yahns/http_client.rb +++ b/lib/yahns/http_client.rb @@ -1,7 +1,7 @@ # -*- encoding: binary -*- # Copyright (C) 2013, Eric Wong and all contributors # License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt) -class Yahns::HttpClient < Kgio::Socket # :nodoc: +module Yahns::HttpClient # :nodoc: < Kgio::Socket # :nodoc: NULL_IO = StringIO.new("") # FIXME: we shouldn't have this at all diff --git a/lib/yahns/rack.rb b/lib/yahns/rack.rb index 3f8f6b7..2b1a0f4 100644 --- a/lib/yahns/rack.rb +++ b/lib/yahns/rack.rb @@ -39,7 +39,8 @@ class Yahns::Rack # :nodoc: end def config_context - ctx_class = Class.new(Yahns::HttpClient) + ctx_class = Class.new(Kgio::Socket) + ctx_class.__send__(:include, Yahns::HttpClient) ctx_class.extend(Yahns::HttpContext) ctx_class.http_ctx_init(self) ctx_class -- EW