From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: * X-Spam-ASN: AS33070 50.56.128.0/17 X-Spam-Status: No, score=1.0 required=3.0 tests=AWL,HK_RANDOM_FROM, MSGID_FROM_MTA_HEADER,TVD_RCVD_IP shortcircuit=no autolearn=no version=3.3.2 Path: news.gmane.org!not-for-mail From: Eric Wong Newsgroups: gmane.comp.lang.ruby.rainbows.general Subject: Re: Sinatra stream(:keep_open) not holding connections open Date: Wed, 5 Dec 2012 03:18:48 +0000 Message-ID: <20121205031848.GA32757@dcvr.yhbt.net> References: <20121205014454.GA24401@dcvr.yhbt.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1354677542 19460 80.91.229.3 (5 Dec 2012 03:19:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 5 Dec 2012 03:19:02 +0000 (UTC) To: Rainbows! list Original-X-From: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Wed Dec 05 04:19:15 2012 Return-path: Envelope-to: gclrrg-rainbows-talk@m.gmane.org X-Original-To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Delivered-To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-BeenThere: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Errors-To: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Xref: news.gmane.org gmane.comp.lang.ruby.rainbows.general:417 Archived-At: Received: from 50-56-192-79.static.cloud-ips.com ([50.56.192.79] helo=rubyforge.org) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Tg5Vx-0006qD-HY for gclrrg-rainbows-talk@m.gmane.org; Wed, 05 Dec 2012 04:19:13 +0100 Received: from localhost.localdomain (localhost [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id 07BEF2E07B; Wed, 5 Dec 2012 03:18:59 +0000 (UTC) Received: from dcvr.yhbt.net (dcvr.yhbt.net [64.71.152.64]) by rubyforge.org (Postfix) with ESMTP id 4226C2E077 for ; Wed, 5 Dec 2012 03:18:50 +0000 (UTC) Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id E42D01F703; Wed, 5 Dec 2012 03:18:48 +0000 (UTC) "W. Andrew Loe III" wrote: > I've pushed a very very stripped down example that just echos the time. > https://github.com/loe/sinatra-sse Thanks for the test case, I've just pushed out the following fix to "master" of git://bogomips.org/rainbows.git I've pushed a rainbows 4.4.1.1.gd5c8c prerelease to RubyGems.org It should be installable with: gem install --pre rainbows I expect this to work for you, but be sure to let me know if it doesn't :x Since this is a pretty small fix, I think I'll push 4.4.2 final very soon. >>From d5c8cc8b51619f0d33f75036c53e3936ad2749b2 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 5 Dec 2012 03:08:19 +0000 Subject: [PATCH] event_machine: properly defer body.close for async Calling body.close in the normal write_response() code path is incorrect, and only worked out of sheer luck with Cramp and async_sinata. This change allows stream(:keep_open) in Sinatra to work properly. Thanks to W. Andrew Loe III for the informative bug report and reproducible test case. ref: http://mid.gmane.org/CA+-9oNd1EFqsniPkkPTwu5opTCinbM7-2KHoXov7+y3LE4s4Tg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org --- lib/rainbows/event_machine/client.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/rainbows/event_machine/client.rb b/lib/rainbows/event_machine/client.rb index e56931f..fc0dfe3 100644 --- a/lib/rainbows/event_machine/client.rb +++ b/lib/rainbows/event_machine/client.rb @@ -64,8 +64,11 @@ class Rainbows::EventMachine::Client < EM::Connection @state = :headers if alive if body.respond_to?(:errback) && body.respond_to?(:callback) @deferred = body + write_headers(status, headers, alive) + write_body_each(body) deferred_errback(body) deferred_callback(body, alive) + return elsif body.respond_to?(:to_path) st = File.stat(path = body.to_path) -- Eric Wong _______________________________________________ Rainbows! mailing list - rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org http://rubyforge.org/mailman/listinfo/rainbows-talk Do not quote signatures (like this one) or top post when replying