event_machine: properly defer body.close for async
commitd5c8cc8b51619f0d33f75036c53e3936ad2749b2
authorEric Wong <normalperson@yhbt.net>
Wed, 5 Dec 2012 03:08:19 +0000 (5 03:08 +0000)
committerEric Wong <normalperson@yhbt.net>
Wed, 5 Dec 2012 03:10:38 +0000 (5 03:10 +0000)
treec12bc60e1c28a43a0d0fa329a3921e9a7a3d0f65
parentfb671a2d316029169940d00a3f9307c3113541c4
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@mail.gmail.com
lib/rainbows/event_machine/client.rb