<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -43,8 +43,10 @@ module Thin
     # is ready to be processed.
     def process
       if threaded?
+        @request.threaded = true
         EventMachine.defer(method(:pre_process), method(:post_process))
       else
+        @request.threaded = false
         post_process(pre_process)
       end
     end
@@ -52,7 +54,6 @@ module Thin
     def pre_process
       # Add client info to the request env
       @request.remote_address = remote_address
-      @request.threaded       = threaded?
       
       # Process the request calling the Rack adapter
       @app.call(@request.env)</diff>
      <filename>lib/thin/connection.rb</filename>
    </modified>
    <modified>
      <diff>@@ -71,8 +71,10 @@ describe Connection do
   end
   
   it &quot;should set request env as rack.multithread&quot; do
+    EventMachine.should_receive(:defer)
+    
     @connection.threaded = true
-    @connection.pre_process
+    @connection.process
     
     @connection.request.env[&quot;rack.multithread&quot;].should == true
   end</diff>
      <filename>spec/connection_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>c90f50f691e8325cd7a964b0a0d3b2052332a0ed</id>
    </parent>
  </parents>
  <author>
    <name>macournoyer</name>
    <email>macournoyer@gmail.com</email>
  </author>
  <url>http://github.com/macournoyer/thin/commit/06439cf6a5ad3034ab7da732449e59e473b3a7c6</url>
  <id>06439cf6a5ad3034ab7da732449e59e473b3a7c6</id>
  <committed-date>2008-04-18T12:27:07-07:00</committed-date>
  <authored-date>2008-04-18T12:27:07-07:00</authored-date>
  <message>Make sure app.deferred?(env) is only called once per request</message>
  <tree>2d63d526fdfd431044e5b478e438a51f5a2ec653</tree>
  <committer>
    <name>macournoyer</name>
    <email>macournoyer@gmail.com</email>
  </committer>
</commit>
