<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,57 @@
-Example
+Shorewall Routing Setup
 -
 
+This setup works...  need to reverse engineer it
+
+$ shorewall show routing
+Shorewall 4.0.12 Routing at steve-laptop - Tue Apr 28 01:13:43 ICT 2009
+
+Routing Rules
+
+0:  from all lookup local 
+10001:  from all fwmark 0x1 lookup ISP0 
+10002:  from all fwmark 0x2 lookup ISP2 
+20000:  from 192.168.1.5 lookup ISP0 
+20256:  from 192.168.0.126 lookup ISP2 
+32766:  from all lookup main 
+32767:  from all lookup default 
+
+Table default:
+
+
+Table ISP0:
+
+192.168.1.1 dev eth0  scope link  src 192.168.1.5 
+192.168.1.0/24 dev eth0  proto kernel  scope link  src 192.168.1.5 
+192.168.0.0/24 dev eth1  proto kernel  scope link  src 192.168.0.126 
+169.254.0.0/16 dev eth0  scope link  metric 1000 
+default via 192.168.1.1 dev eth0 
+
+Table ISP2:
+
+192.168.0.1 dev eth1  scope link  src 192.168.0.126 
+192.168.1.0/24 dev eth0  proto kernel  scope link  src 192.168.1.5 
+192.168.0.0/24 dev eth1  proto kernel  scope link  src 192.168.0.126 
+169.254.0.0/16 dev eth0  scope link  metric 1000 
+default via 192.168.0.1 dev eth1 
+
+Table local:
+
+broadcast 192.168.1.0 dev eth0  proto kernel  scope link  src 192.168.1.5 
+broadcast 192.168.0.255 dev eth1  proto kernel  scope link  src 192.168.0.126 
+broadcast 127.255.255.255 dev lo  proto kernel  scope link  src 127.0.0.1 
+local 192.168.1.5 dev eth0  proto kernel  scope host  src 192.168.1.5 
+local 192.168.0.126 dev eth1  proto kernel  scope host  src 192.168.0.126 
+broadcast 192.168.1.255 dev eth0  proto kernel  scope link  src 192.168.1.5 
+broadcast 192.168.0.0 dev eth1  proto kernel  scope link  src 192.168.0.126 
+broadcast 127.0.0.0 dev lo  proto kernel  scope link  src 127.0.0.1 
+local 127.0.0.1 dev lo  proto kernel  scope host  src 127.0.0.1 
+local 127.0.0.0/8 dev lo  proto kernel  scope host  src 127.0.0.1 
+
+Table main:
+
 192.168.1.0/24 dev eth0  proto kernel  scope link  src 192.168.1.5 
-192.168.0.0/24 dev eth1  proto kernel  scope link  src 192.168.0.127 
+192.168.0.0/24 dev eth1  proto kernel  scope link  src 192.168.0.126 
+169.254.0.0/16 dev eth0  scope link  metric 1000 
+default via 192.168.0.1 dev eth1 
+default via 192.168.1.1 dev eth0  metric 100 </diff>
      <filename>ROUTING</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,5 @@
 - allow user to specify packet size, queue up data until size is reached or 0.x seconds has passed since last data received
+- test send data received before connection created
 
 new todo:
 - move outgoing queue to TunneledConnection, and have TunnelGroup iterate through connections sending one cmd</diff>
      <filename>TODO</filename>
    </modified>
    <modified>
      <diff>@@ -54,6 +54,7 @@ module TunnelSplitter
         @client = client
         @tunnel_group = @client.tunnel_group
         @seq = 0
+        @start_time = Time.now
       end
 
       def post_init
@@ -61,10 +62,12 @@ module TunnelSplitter
       end
 
       def receive_data(data)
+        @start_data ||= data
         @tunnel_group.queue_out Command::SendData.new(@connection_id, @seq += 1, data)
       end
 
       def unbind
+        puts &quot;%5.2f %s&quot; % [Time.now - @start_time, @start_data.inspect]
         @client.connection_for(@connection_id).connection_closed = true
         @tunnel_group.connection_closed(@connection_id, @seq += 1)
       end
@@ -83,6 +86,7 @@ module TunnelSplitter
         while cmd = Command.parse(@buffer)
           case cmd
           when Command::SendData, Command::CloseConnection
+            p cmd.data.size  if cmd.respond_to? :data
             tunneled_connection = @client.connection_for(cmd.connection_id)
             tunneled_connection.queue_in(cmd, self)
           when Command::Ack</diff>
      <filename>lib/tunnel_splitter/client.rb</filename>
    </modified>
    <modified>
      <diff>@@ -61,13 +61,38 @@ module TunnelSplitter
         @server, @connection_id = server, connection_id
         @tunnel_group = @server.tunnel_group
         @seq = 0
+        @buffer = ''
+        @max_buffer_size, @max_buffer_time, @last_flush = 1024, 0.1, Time.now
       end
 
       def receive_data(data)
-        @tunnel_group.queue_out Command::SendData.new(@connection_id, @seq += 1, data)
+        @buffer &lt;&lt; data
+        flush!
+        #flush
+      end
+
+      def flush
+        if @buffer.size &gt; @max_buffer_size or (Time.now - @last_flush) &gt; @max_buffer_time
+          flush!
+          if @flush_timer
+            EM.cancel_timer @flush_timer  if @flush_timer
+            @flush_timer = nil
+          end
+        else
+          wait = [0.01, @max_buffer_time - (Time.now - @last_flush)].max
+          EM.cancel_timer @flush_timer  if @flush_timer
+          @flush_timer = EM.add_timer(wait) { flush }
+        end
+      end
+
+      def flush!
+        @tunnel_group.queue_out Command::SendData.new(@connection_id, @seq += 1, @buffer)
+        @last_flush = Time.now
+        @buffer = ''
       end
 
       def unbind
+        flush!
         @server.connection_for(@connection_id).connection_closed = true
         @tunnel_group.connection_closed(@connection_id, @seq += 1)
       end</diff>
      <filename>lib/tunnel_splitter/server.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>34591df4ca92987fb3656c24b403ae699c7f3fec</id>
    </parent>
  </parents>
  <author>
    <name>steve</name>
    <email>coderrr.contact@gmail.com</email>
  </author>
  <url>http://github.com/coderrr/tunnel_splitter/commit/c9aa039653d30a2546dec5425abeda7886e63ff5</url>
  <id>c9aa039653d30a2546dec5425abeda7886e63ff5</id>
  <committed-date>2009-04-27T21:49:52-07:00</committed-date>
  <authored-date>2009-04-27T21:49:52-07:00</authored-date>
  <message>experimental buffering strategy ala nagle</message>
  <tree>34b81934ad294125d8a94f875b0ba19392cb1390</tree>
  <committer>
    <name>steve</name>
    <email>coderrr.contact@gmail.com</email>
  </committer>
</commit>
