Rainbows! Rack HTTP server user/dev discussion
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: rainbows-public@bogomips.org
Subject: [PATCH 4/6] sync_close: This fix breakage from Ruby-trunk r50118
Date: Mon, 14 Sep 2015 05:33:16 +0000	[thread overview]
Message-ID: <20150914053318.12251-5-e@80x24.org> (raw)
In-Reply-To: <20150914053318.12251-1-e@80x24.org>

By providing read+readpartial methods

IO.copy_stream behaves slightly differently when operating on
non-IO-subclassed objects nowadays.

Ref:
> * io.c (copy_stream_body): use the arguments without conversion if
>   having read, readpartial, and write methods, than conversion by
>   to_path method.  [ruby-core:68676] [Bug #11015]
---
 lib/rainbows/sync_close.rb | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/lib/rainbows/sync_close.rb b/lib/rainbows/sync_close.rb
index 75f119e..8738cae 100644
--- a/lib/rainbows/sync_close.rb
+++ b/lib/rainbows/sync_close.rb
@@ -16,6 +16,14 @@ class Rainbows::SyncClose
     @body.respond_to?(m)
   end
 
+  def readpartial(*args)
+    @body.readpartial(*args)
+  end
+
+  def read(*args)
+    @body.read(*args)
+  end
+
   def to_path
     @body.to_path
   end
@@ -31,7 +39,7 @@ class Rainbows::SyncClose
   # called by the writer thread to wake up the original thread (in #initialize)
   def close
     @body.close
-    ensure
-      @mutex.synchronize { @cv.signal }
+  ensure
+    @mutex.synchronize { @cv.signal }
   end
 end
-- 
EW


  parent reply	other threads:[~2015-09-14  5:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-14  5:33 [PATCH 0/6] misc updates for Ruby-trunk and gem changes Eric Wong
2015-09-14  5:33 ` [PATCH 1/6] build: fix quoting issue with double parens Eric Wong
2015-09-14  5:33 ` [PATCH 2/6] response: avoid unnecessary args to IO.copy_stream Eric Wong
2015-09-14  5:33 ` [PATCH 3/6] t/close-has-env.ru: ensure close is idempotent Eric Wong
2015-09-14  5:33 ` Eric Wong [this message]
2015-09-14  5:33 ` [PATCH 5/6] t/t0044-autopush.sh: remove test Eric Wong
2016-12-24 22:04   ` Eric Wong
2015-09-14  5:33 ` [PATCH 6/6] t/test_isolate.rb: updates for various gem versions Eric Wong

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/rainbows/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150914053318.12251-5-e@80x24.org \
    --to=e@80x24.org \
    --cc=rainbows-public@bogomips.org \
    /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/rainbows.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).