<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/thin/backends/base.rb</filename>
    </added>
    <added>
      <filename>lib/thin/backends/swiftiply_client.rb</filename>
    </added>
    <added>
      <filename>lib/thin/backends/tcp_server.rb</filename>
    </added>
    <added>
      <filename>lib/thin/backends/unix_server.rb</filename>
    </added>
    <added>
      <filename>spec/backends/swiftiply_client_spec.rb</filename>
    </added>
    <added>
      <filename>spec/backends/tcp_server_spec.rb</filename>
    </added>
    <added>
      <filename>spec/backends/unix_server_spec.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,4 +1,5 @@
 == 0.7.1 Fancy Pants release
+ * Rename Connector to Backend. Extend Thin::Backends::Base to implement your own.
  * Fix high memory usage with big POST body, fixes #48
 
 == 0.7.0 Spherical Cow release</diff>
      <filename>CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -22,11 +22,11 @@ module Thin
   autoload :Server,             'thin/server'
   autoload :Stats,              'thin/stats'
   
-  module Connectors
-    autoload :Connector,        'thin/connectors/connector'
-    autoload :SwiftiplyClient,  'thin/connectors/swiftiply_client'
-    autoload :TcpServer,        'thin/connectors/tcp_server'
-    autoload :UnixServer,       'thin/connectors/unix_server'
+  module Backends
+    autoload :Base,             'thin/backends/base'
+    autoload :SwiftiplyClient,  'thin/backends/swiftiply_client'
+    autoload :TcpServer,        'thin/backends/tcp_server'
+    autoload :UnixServer,       'thin/backends/unix_server'
   end
   
   module Controllers</diff>
      <filename>lib/thin.rb</filename>
    </modified>
    <modified>
      <diff>@@ -10,8 +10,8 @@ module Thin
     # Rack application served by this connection.
     attr_accessor :app
     
-    # Connector to the server
-    attr_accessor :connector
+    # Backend to the server
+    attr_accessor :backend
     
     # Current request served by the connection
     attr_accessor :request
@@ -72,7 +72,7 @@ module Thin
     # Called when the connection is unbinded from the socket
     # and can no longer be used to process requests.
     def unbind
-      @connector.connection_finished(self)
+      @backend.connection_finished(self)
     end
     
     # Allows this connection to be persistent.</diff>
      <filename>lib/thin/connection.rb</filename>
    </modified>
    <modified>
      <diff>@@ -31,7 +31,7 @@ module Thin
         when @options.has_key?(:socket)
           Server.new(@options[:socket])
         when @options.has_key?(:swiftiply)
-          Server.new(Connectors::SwiftiplyClient.new(@options[:address], @options[:port], @options[:swiftiply]))
+          Server.new(Backends::SwiftiplyClient.new(@options[:address], @options[:port], @options[:swiftiply]))
         else
           Server.new(@options[:address], @options[:port])
         end</diff>
      <filename>lib/thin/controllers/controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 module Thin
   # The uterly famous Thin HTTP server.
-  # It listen for incoming request through a given connector
+  # It listen for incoming request through a given backend
   # and forward all request to +app+.
   #
   # == TCP server
@@ -16,12 +16,12 @@ module Thin
   #
   #   Thin::Server.start('/tmp/thin.sock', nil, app)
   #
-  # == Using a custom connector
+  # == Using a custom backend
   # You can implement your own way to connect the server to its client by creating your
-  # own Thin::Connectors::Connector class and pass it as the first argument.
+  # own Backend class and pass it as the first argument.
   #
-  #   connector = Thin::Connectors::MyFancyConnector.new('galaxy://faraway:1345')
-  #   Thin::Server.start(connector, nil, app)
+  #   backend = Thin::Backends::MyFancyBackend.new('galaxy://faraway:1345')
+  #   Thin::Server.start(backend, nil, app)
   #
   # == Rack application (+app+)
   # All requests will be processed through +app+ that must be a valid Rack adapter.
@@ -55,46 +55,46 @@ module Thin
     # Application (Rack adapter) called with the request that produces the response.
     attr_accessor :app
     
-    # Connector handling the connections to the clients.
-    attr_accessor :connector
+    # Backend handling the connections to the clients.
+    attr_accessor :backend
     
     # Maximum number of file or socket descriptors that the server may open.
     attr_accessor :maximum_connections
     
     # Maximum number of seconds for incoming data to arrive before the connection
     # is dropped.
-    def_delegators :@connector, :timeout, :timeout=
+    def_delegators :@backend, :timeout, :timeout=
     
     # Maximum number of connection that can be persistent at the same time.
     # Most browser never close the connection so most of the time they are closed
     # when the timeout occur. If we don't control the number of persistent connection,
     # if would be very easy to overflow the server for a DoS attack.
-    def_delegators :@connector, :maximum_persistent_connections, :maximum_persistent_connections=
+    def_delegators :@backend, :maximum_persistent_connections, :maximum_persistent_connections=
     
     # Address and port on which the server is listening for connections.
-    def_delegators :@connector, :host, :port
+    def_delegators :@backend, :host, :port
     
     # UNIX domain socket on which the server is listening for connections.
-    def_delegator :@connector, :socket
+    def_delegator :@backend, :socket
     
-    def initialize(host_or_socket_or_connector, port=DEFAULT_PORT, app=nil, &amp;block)
-      # Try to intelligently select which connector to use.
-      @connector = case
-      when host_or_socket_or_connector.is_a?(Connectors::Connector)
-        host_or_socket_or_connector
-      when host_or_socket_or_connector.include?('/')
-        Connectors::UnixServer.new(host_or_socket_or_connector)
+    def initialize(host_or_socket_or_backend, port=DEFAULT_PORT, app=nil, &amp;block)
+      # Try to intelligently select which backend to use.
+      @backend = case
+      when host_or_socket_or_backend.is_a?(Backends::Base)
+        host_or_socket_or_backend
+      when host_or_socket_or_backend.include?('/')
+        Backends::UnixServer.new(host_or_socket_or_backend)
       else
-        Connectors::TcpServer.new(host_or_socket_or_connector, port.to_i)
+        Backends::TcpServer.new(host_or_socket_or_backend, port.to_i)
       end
 
-      @app              = app
-      @connector.server = self
+      @app            = app
+      @backend.server = self
       
       # Set defaults
-      @maximum_connections                      = DEFAULT_MAXIMUM_CONNECTIONS
-      @connector.maximum_persistent_connections = DEFAULT_MAXIMUM_PERSISTENT_CONNECTIONS
-      @connector.timeout                        = DEFAULT_TIMEOUT
+      @maximum_connections                    = DEFAULT_MAXIMUM_CONNECTIONS
+      @backend.maximum_persistent_connections = DEFAULT_MAXIMUM_PERSISTENT_CONNECTIONS
+      @backend.timeout                        = DEFAULT_TIMEOUT
       
       # Allow using Rack builder as a block
       @app = Rack::Builder.new(&amp;block).to_app if block
@@ -123,18 +123,18 @@ module Thin
       raise ArgumentError, 'app required' unless @app
       
       setup_signals
-            
+      
       # See http://rubyeventmachine.com/pub/rdoc/files/EPOLL.html
       EventMachine.epoll
       
       log   &quot;&gt;&gt; Thin web server (v#{VERSION::STRING} codename #{VERSION::CODENAME})&quot;
       debug &quot;&gt;&gt; Debugging ON&quot;
       trace &quot;&gt;&gt; Tracing ON&quot;
-            
-      log &quot;&gt;&gt; Listening on #{@connector}, CTRL+C to stop&quot;
+      
+      log &quot;&gt;&gt; Listening on #{@backend}, CTRL+C to stop&quot;
       
       @running = true
-      EventMachine.run { @connector.connect }
+      EventMachine.run { @backend.connect }
     end
     alias :start! :start
     
@@ -148,7 +148,7 @@ module Thin
         @running = false
         
         # Do not accept anymore connection
-        @connector.disconnect
+        @backend.disconnect
         
         unless wait_for_connections_and_stop
           # Still some connections running, schedule a check later
@@ -166,14 +166,14 @@ module Thin
     def stop!
       log &quot;&gt;&gt; Stopping ...&quot;
 
-      @connector.close_connections
+      @backend.close_connections
       EventMachine.stop
 
-      @connector.close
+      @backend.close
     end
         
     def name
-      &quot;thin server (#{@connector})&quot;
+      &quot;thin server (#{@backend})&quot;
     end
     alias :to_s :name
     
@@ -204,11 +204,11 @@ module Thin
     
     protected            
       def wait_for_connections_and_stop
-        if @connector.empty?
+        if @backend.empty?
           stop!
           true
         else
-          log &quot;&gt;&gt; Waiting for #{@connector.size} connection(s) to finish, can take up to #{timeout} sec, CTRL+C to stop now&quot;
+          log &quot;&gt;&gt; Waiting for #{@backend.size} connection(s) to finish, can take up to #{timeout} sec, CTRL+C to stop now&quot;
           false
         end
       end</diff>
      <filename>lib/thin/server.rb</filename>
    </modified>
    <modified>
      <diff>@@ -51,7 +51,7 @@ module BleakInstruments
     end
   end
   
-  module Connector
+  module Backend
     def self.included(base)
       base.class_eval do
         alias_method_chain :connect, :instrument
@@ -61,12 +61,12 @@ module BleakInstruments
     
     def connect_with_instrument
       connect_without_instrument
-      $memlogger.snapshot($logfile, &quot;connector/connect&quot;, false, 0.1)
+      $memlogger.snapshot($logfile, &quot;backend/connect&quot;, false, 0.1)
     end
     
     def initialize_connection_with_instrument(connection)
       initialize_connection_without_instrument(connection)
-      $memlogger.snapshot($logfile, &quot;connector/initialize_connection&quot;, false, 0.1)
+      $memlogger.snapshot($logfile, &quot;backend/initialize_connection&quot;, false, 0.1)
     end
   end
 end
@@ -76,7 +76,7 @@ require 'bleak_house'
 require File.dirname(__FILE__) + '/../lib/thin'
 
 Thin::Connection.send :include, BleakInstruments::Connection
-Thin::Connectors::TcpServer.send :include, BleakInstruments::Connector
+Thin::Backends::TcpServer.send :include, BleakInstruments::Backend
 
 $memlogger = BleakHouse::Logger.new
 File.delete($logfile = File.expand_path(&quot;log/memlog&quot;)) rescue nil</diff>
      <filename>script/bleak</filename>
    </modified>
    <modified>
      <diff>@@ -75,8 +75,8 @@ describe Server, &quot;HTTP pipelining&quot; do
     socket2.write &quot;GET / HTTP/1.1\r\n\r\n&quot;
     socket2.flush
     
-    @server.connector.persistent_connection_count.should == 1
-    @server.connector.size.should == 2
+    @server.backend.persistent_connection_count.should == 1
+    @server.backend.size.should == 2
     
     socket1.close    
     socket2.close
@@ -87,14 +87,14 @@ describe Server, &quot;HTTP pipelining&quot; do
     socket.write &quot;GET / HTTP/1.1\r\n\r\n&quot;
     socket.flush
     
-    @server.connector.persistent_connection_count.should == 1
+    @server.backend.persistent_connection_count.should == 1
     
     socket.write &quot;GET / HTTP/1.1\r\nConnection: close\r\n\r\n&quot;
     socket.close
     
     wait_for_requests_to_complete!
     
-    @server.connector.persistent_connection_count.should == 0
+    @server.backend.persistent_connection_count.should == 0
   end
   
   after do
@@ -103,6 +103,6 @@ describe Server, &quot;HTTP pipelining&quot; do
   
   private
     def wait_for_requests_to_complete!
-      sleep 0.1 until @server.connector.size == 0
+      sleep 0.1 until @server.backend.size == 0
     end
 end
\ No newline at end of file</diff>
      <filename>spec/server/pipelining_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -6,7 +6,7 @@ describe Server, 'on Swiftiply' do
       exec &quot;swiftiply -c #{File.dirname(__FILE__)}/swiftiply.yml&quot;
     end
     sleep 0.5
-    start_server(Connectors::SwiftiplyClient.new('0.0.0.0', 5555, nil)) do |env|
+    start_server(Backends::SwiftiplyClient.new('0.0.0.0', 5555, nil)) do |env|
       body = env.inspect + env['rack.input'].read
       [200, { 'Content-Type' =&gt; 'text/html', 'Content-Length' =&gt; body.size.to_s }, body]
     end</diff>
      <filename>spec/server/swiftiply_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -150,7 +150,7 @@ module Helpers
   end
     
   def send_data(data)
-    if @server.connector.class == Connectors::UnixServer
+    if @server.backend.class == Backends::UnixServer
       socket = UNIXSocket.new(@server.socket)
     else
       socket = TCPSocket.new(@server.host, @server.port)
@@ -162,7 +162,7 @@ module Helpers
   end
   
   def get(url)
-    if @server.connector.class == Connectors::UnixServer
+    if @server.backend.class == Backends::UnixServer
       send_data(&quot;GET #{url} HTTP/1.1\r\nConnection: close\r\n\r\n&quot;)
     else
       Net::HTTP.get(URI.parse(&quot;http://#{@server.host}:#{@server.port}&quot; + url))</diff>
      <filename>spec/spec_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -13,7 +13,7 @@ else
     t.spec_files = FileList['spec/**/*_spec.rb']
     if WIN
       t.spec_files -= [
-          'spec/connectors/unix_server_spec.rb',
+          'spec/backends/unix_server_spec.rb',
           'spec/controllers/service_spec.rb',
           'spec/daemonizing_spec.rb',
           'spec/server/unix_socket_spec.rb',</diff>
      <filename>tasks/spec.rake</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>lib/thin/connectors/connector.rb</filename>
    </removed>
    <removed>
      <filename>lib/thin/connectors/swiftiply_client.rb</filename>
    </removed>
    <removed>
      <filename>lib/thin/connectors/tcp_server.rb</filename>
    </removed>
    <removed>
      <filename>lib/thin/connectors/unix_server.rb</filename>
    </removed>
    <removed>
      <filename>spec/connectors/swiftiply_client_spec.rb</filename>
    </removed>
    <removed>
      <filename>spec/connectors/tcp_server_spec.rb</filename>
    </removed>
    <removed>
      <filename>spec/connectors/unix_server_spec.rb</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>659446428f3dc609addbe940b26eb0d5638577e6</id>
    </parent>
  </parents>
  <author>
    <name>macournoyer</name>
    <email>macournoyer@gmail.com</email>
  </author>
  <url>http://github.com/macournoyer/thin/commit/b686394e285dd2e188aa990bafc94d31a12ed92f</url>
  <id>b686394e285dd2e188aa990bafc94d31a12ed92f</id>
  <committed-date>2008-02-28T18:23:39-08:00</committed-date>
  <authored-date>2008-02-28T18:23:39-08:00</authored-date>
  <message>Rename Connector to Backend. Extend Thin::Backends::Base to implement your own.</message>
  <tree>e3a26d921d2e672f41ed49031e83739d94c0cb84</tree>
  <committer>
    <name>macournoyer</name>
    <email>macournoyer@gmail.com</email>
  </committer>
</commit>
