Skip to content
Browse files

Trying to match nil to a regex was killing the read thread X_X

  • Loading branch information...
1 parent 74924b8 commit d350df0090ecb65ce12d2f6b59faa63af5e39239 @vickash vickash committed Mar 2, 2013
Showing with 4 additions and 3 deletions.
  1. +3 −2 lib/dino/tx_rx/base.rb
  2. +1 −1 lib/dino/version.rb
View
5 lib/dino/tx_rx/base.rb
@@ -10,7 +10,7 @@ def read
@thread ||= Thread.new do
loop do
line = gets
- if line.match /\A\d+:/
+ if line && line.match(/\A\d+:/)
pin, message = line.chop.split(/:/)
pin && message && changed && notify_observers(pin, message)
end
@@ -34,12 +34,13 @@ def write(message)
end
def handshake
+ flush_read
100.times do
begin
write("!9000000.")
Timeout::timeout(0.1) do
line = gets.to_s
- if line.match /ACK/
+ if line.match /ACK:/
flush_read
return line.chop.split(/:/)[1].to_i
end
View
2 lib/dino/version.rb
@@ -1,3 +1,3 @@
module Dino
- VERSION = "0.11.0"
+ VERSION = "0.11.1"
end

0 comments on commit d350df0

Please sign in to comment.
Something went wrong with that request. Please try again.