<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -153,9 +153,7 @@ module NickelSilver
         @clients &lt;&lt; client
     
         # output the bytes
-        @interface.io_mutex.synchronize do
-          @interface.output_buffer += packet
-        end
+        @interface.write packet
     
         # keep waiting for packets either for 2 seconds passes or we get a match
         start = Time.now
@@ -199,37 +197,29 @@ module NickelSilver
         end
       end
   
-  
       # Process incoming packets and notficy clients.
       def process_packets
         packet = []
         loop do
-          # wait for data in the buffer
-          # sleep long enough to avoid pegging the CPU 
-          while @interface.input_buffer.empty?
-            sleep(0.1)
-          end
-      
-          # get the next byte out of the buffer
-          byte = 0
-          @interface.io_mutex.synchronize do
-            byte = @interface.input_buffer.shift
-          end
-                  
-          # if this is the first byte it must have its msb set
-          packet &lt;&lt; byte unless packet.empty? &amp;&amp; byte &lt; 0b1000_0000
+          @interface.read.each do |byte|
+            # if this is the first byte it must have its msb set
+            packet &lt;&lt; byte unless packet.empty? &amp;&amp; byte &lt; 0b1000_0000
       
-          # if we somehow got another opcode before completing a packet
-          # then dump the current broken packet and start over
-          packet = [byte] if byte &gt;= 0b1000_0000
+            # if we somehow got another opcode before completing a packet
+            # then dump the current broken packet and start over
+            packet = [byte] if byte &gt;= 0b1000_0000
       
-          # notify clients if the packet is complete
-          if packet_complete?( packet )
-            notify_clients( packet )
+            # notify clients if the packet is complete
+            if packet_complete?( packet )
+              notify_clients( packet )
         
-            # reset cuurent packet
-            packet = []
+              # reset cuurent packet
+              packet = []
+            end
           end
+          
+          # sleep long enough to avoid pegging the CPU
+          sleep( 0.1 )
         end
       end
   </diff>
      <filename>lib/LocoNetServer.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>eaf2b2f830b04136ae1d5bec93baa7985ff5c918</id>
    </parent>
  </parents>
  <author>
    <name>toholio</name>
    <email>tobin.richard@gmail.com</email>
  </author>
  <url>http://github.com/toholio/nickel-silver-server/commit/3a2dfe03c03192f78e19386da7c69dd12c8c65ff</url>
  <id>3a2dfe03c03192f78e19386da7c69dd12c8c65ff</id>
  <committed-date>2008-09-01T00:35:44-07:00</committed-date>
  <authored-date>2008-09-01T00:35:44-07:00</authored-date>
  <message>Update the LocoNetServer class to work with the recently improved LocoBufferUSB encapsulation.</message>
  <tree>eae2eb2d6c5b5b0add3977f420404b104f4aa676</tree>
  <committer>
    <name>toholio</name>
    <email>tobin.richard@gmail.com</email>
  </committer>
</commit>
