From: Eric Wong <e@80x24.org>
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 [thread overview]
Message-ID: <1419048700-32075-1-git-send-email-e@80x24.org> (raw)
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 <normalperson@yhbt.net> 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
reply other threads:[~2014-12-20 4:11 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://yhbt.net/yahns/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1419048700-32075-1-git-send-email-e@80x24.org \
--to=e@80x24.org \
--cc=yahns-public@yhbt.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhbt.net/yahns.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).