<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -3,7 +3,8 @@ BERTRPC
 
 By Tom Preston-Werner (tom@mojombo.com)
 
-BERT-RPC client library for Ruby. Makes it ridiculously simple to interface with BERT-RPC servers.
+BERT-RPC client library for Ruby. Makes it ridiculously simple to interface
+with BERT-RPC servers.
 
 See the full BERT-RPC specification at [bert-rpc.org](http://bert-rpc.org).
 
@@ -12,7 +13,9 @@ This library currently only supports the following BERT-RPC features:
 * `call` requests
 * `cast` requests
 
-BERTRPC was developed for GitHub and is currently in production use performing millions of RPC requests every day. The stability and performance have been exemplary.
+BERTRPC was developed for GitHub and is currently in production use performing
+millions of RPC requests every day. The stability and performance have been
+exemplary.
 
 
 Installation
@@ -50,6 +53,18 @@ The underlying BERT-RPC transaction of the above cast is:
     &lt;- {noreply}
 
 
+Documentation
+-------------
+
+Creating a service:
+
+    # No timeout
+    svc = BERTRPC::Service.new('localhost', 9999)
+    
+    # 10s socket read timeout, raises BERTRPC::ReadTimeoutError
+    svc = BERTRPC::Service.new('localhost', 9999, 10)
+
+
 Copyright
 ---------
 </diff>
      <filename>README.md</filename>
    </modified>
    <modified>
      <diff>@@ -42,8 +42,10 @@ module BERTRPC
       raise ProtocolError.new(ProtocolError::NO_DATA) unless bert_response
       sock.close
       bert_response
-    rescue Errno::ECONNREFUSED, Timeout::Error
+    rescue Errno::ECONNREFUSED
       raise ConnectionError.new(&quot;Unable to connect to #{@svc.host}:#{@svc.port}&quot;)
+    rescue Timeout::Error
+      raise ReadTimeoutError.new(&quot;No response from #{@svc.host}:#{@svc.port} in #{@svc.timeout}s&quot;)
     end
 
     # Creates a socket object which does speedy, non-blocking reads</diff>
      <filename>lib/bertrpc/action.rb</filename>
    </modified>
    <modified>
      <diff>@@ -28,6 +28,10 @@ module BERTRPC
 
   end
 
+  class ReadTimeoutError &lt; BERTRPCError
+
+  end
+
   class ProtocolError &lt; BERTRPCError
     NO_HEADER = [0, &quot;Unable to read length header from server.&quot;]
     NO_DATA = [1, &quot;Unable to read data from server.&quot;]</diff>
      <filename>lib/bertrpc/errors.rb</filename>
    </modified>
    <modified>
      <diff>@@ -89,6 +89,20 @@ class ActionTest &lt; Test::Unit::TestCase
           assert_equal 1, e.code
         end
       end
+
+      should &quot;raise a ReadTimeoutError when the connection times out&quot; do
+        io = stub()
+        io.expects(:write).with(&quot;\000\000\000\003&quot;)
+        io.expects(:write).with(&quot;foo&quot;)
+        io.expects(:read).with(4).raises(Timeout::Error)
+        @call.expects(:connect_to).returns(io)
+        begin
+          @call.transaction(&quot;foo&quot;)
+          fail &quot;Should have thrown an error&quot;
+        rescue BERTRPC::ReadTimeoutError =&gt; e
+          assert_equal 0, e.code
+        end
+      end
     end
   end
 end</diff>
      <filename>test/action_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,10 +2,15 @@ require 'test_helper'
 
 class ServiceTest &lt; Test::Unit::TestCase
   context &quot;A Service&quot; do
-    should &quot;be created with host and port&quot; do
+    should &quot;be creatable with host and port&quot; do
       svc = BERTRPC::Service.new('localhost', 9941)
       assert svc.is_a?(BERTRPC::Service)
     end
+
+    should &quot;be creatable with host, port, and timeout&quot; do
+      svc = BERTRPC::Service.new('localhost', 9941, 5)
+      assert svc.is_a?(BERTRPC::Service)
+    end
   end
 
   context &quot;A Service Instance's&quot; do</diff>
      <filename>test/service_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>93edc15f41678e976462630116387a92af1da0f4</id>
    </parent>
  </parents>
  <author>
    <name>Tom Preston-Werner</name>
    <email>tom@mojombo.com</email>
  </author>
  <url>http://github.com/mojombo/bertrpc/commit/53562b96e6f1e2da961c71c426506d6c2168131a</url>
  <id>53562b96e6f1e2da961c71c426506d6c2168131a</id>
  <committed-date>2009-10-27T15:13:13-07:00</committed-date>
  <authored-date>2009-10-27T15:13:13-07:00</authored-date>
  <message>make socket read timeout raise a BERTRPC::ReadTimeoutError and enhance readme</message>
  <tree>bd2c2548842a1131c3c80969129d917f951a7009</tree>
  <committer>
    <name>Tom Preston-Werner</name>
    <email>tom@mojombo.com</email>
  </committer>
</commit>
