<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,5 @@
+require 'rack/lobster'
+
 class Benchmarker
   PORT    = 7000
   ADDRESS = '0.0.0.0'
@@ -5,7 +7,7 @@ class Benchmarker
   attr_accessor :requests, :concurrencies, :servers, :keep_alive
   
   def initialize
-    @servers = %w(WEBrick Mongrel EMongrel Thin)
+    @servers = %w(Mongrel EMongrel Thin)
     @requests = 1000
     @concurrencies = [1, 10, 100]
   end</diff>
      <filename>benchmark/benchmarker.rb</filename>
    </modified>
    <modified>
      <diff>@@ -49,13 +49,14 @@ when :table
 when :graph
   require '/usr/local/lib/ruby/gems/1.8/gems/gruff-0.2.9/lib/gruff'
   g = Gruff::Area.new
-  g.title = &quot;Server benchmark (#{options[:requests]} requests&quot;
-  g.title &lt;&lt; ', w/ Keep-Alive' if options[:keep_alive]
-  g.title &lt;&lt; ')'
+  g.title = &quot;#{options[:requests]} requests&quot;
+  g.title &lt;&lt; ' w/ Keep-Alive' if options[:keep_alive]
   
-  g.x_axis_label = 'Concurrency'
-  g.y_axis_label = 'Requests / sec'
-  g.labels = {}
+  g.x_axis_label  = 'Concurrency'
+  g.y_axis_label  = 'Requests / sec'
+  g.maximum_value = 0
+  g.minimum_value = 0
+  g.labels        = {}
   b.concurrencies.each_with_index { |c, i| g.labels[i] = c.to_s }
   
   results = {}
@@ -65,7 +66,7 @@ when :graph
     results[server] ||= []
     results[server] &lt;&lt; req_sec
   end
-    
+  
   b.run!
   puts
   </diff>
      <filename>benchmark/runner</filename>
    </modified>
    <modified>
      <diff>@@ -52,9 +52,9 @@ module Thin
       # If no more request on that same connection, we close it.
       close_connection_after_writing unless persistent?
       
-    rescue Object =&gt; e
-      log &quot;Unexpected error while processing request: #{e.message}&quot;
-      log_error e
+    rescue
+      log &quot;Unexpected error while processing request: #{$!.message}&quot;
+      log_error
       close_connection rescue nil
     ensure
       @request.close  rescue nil
@@ -77,18 +77,15 @@ module Thin
       @response.persistent?
     end
     
+    # IP Address of the remote client.
     def remote_address
-      @request.forwarded_for || (has_peername? ? socket_address : nil)
+      @request.forwarded_for || socket_address
     rescue
-      log_error($!)
+      log_error
       nil
     end
     
     protected
-      def has_peername?
-        !get_peername.nil? &amp;&amp; !get_peername.empty?
-      end
-      
       def socket_address
         Socket.unpack_sockaddr_in(get_peername)[1]
       end</diff>
      <filename>lib/thin/connection.rb</filename>
    </modified>
    <modified>
      <diff>@@ -42,7 +42,7 @@ module Thin
       end
       
       # Log an error backtrace if debugging is activated
-      def log_error(e)
+      def log_error(e=$!)
         debug &quot;#{e}\n\t&quot; + e.backtrace.join(&quot;\n\t&quot;)
       end
   end</diff>
      <filename>lib/thin/logging.rb</filename>
    </modified>
    <modified>
      <diff>@@ -3,10 +3,19 @@
 # Takes the same arguments as the thin script.
 require 'rubygems'
 require 'ruby-prof'
+require File.dirname(__FILE__) + '/../lib/thin'
+
+class Adapter
+  def call(env)
+    [200, {'Content-Type' =&gt; 'text/html', 'Content-Length' =&gt; '11'}, ['hello world']]
+  end
+end
 
 # Profile the code
 result = RubyProf.profile do
-  load 'bin/thin'
+  Thin::Server.start('0.0.0.0', 3000) do
+    run Adapter.new
+  end
 end
 
 # Print a graph profile to text</diff>
      <filename>script/profile</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>18296dabdb4cf8a5c419c54639958a35da06e270</id>
    </parent>
  </parents>
  <author>
    <name>macournoyer</name>
    <email>macournoyer@gmail.com</email>
  </author>
  <url>http://github.com/macournoyer/thin/commit/dd6b82a8c65debd437158c26aae5dde340a2d7a7</url>
  <id>dd6b82a8c65debd437158c26aae5dde340a2d7a7</id>
  <committed-date>2008-02-16T20:03:40-08:00</committed-date>
  <authored-date>2008-02-16T20:03:40-08:00</authored-date>
  <message>Optimize Connection#remote_address for non-failures.
Couple fix in benchmark script.
Fix profile script to profile only Thin server.</message>
  <tree>11f9535036dd659338ac29200fef65647f6079f7</tree>
  <committer>
    <name>macournoyer</name>
    <email>macournoyer@gmail.com</email>
  </committer>
</commit>
