Navigation Menu

Skip to content

Commit

Permalink
Simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Apr 22, 2015
1 parent 26b5e57 commit 394b3e8
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions lib/droonga/fluent_message_receiver.rb
Expand Up @@ -141,11 +141,8 @@ def start
@socket = UDPSocket.for_fd(@fd)

@watcher = Coolio::IOWatcher.new(@socket, "r")
on_readable = lambda do
receive_heartbeat
end
@watcher.on_readable do
on_readable.call
receive_heartbeat
end
@loop.attach(@watcher)
# logger.trace("start: new heartbeat watcher attached",
Expand Down Expand Up @@ -199,20 +196,14 @@ def initialize(io, &on_message)
@on_close = nil
@unpacker = MessagePack::Unpacker.new

on_read = lambda do |data|
feed(data)
end
@io.on_read do |data|
on_read.call(data)
feed(data)
end

on_close = lambda do
@io.on_close do
@io = nil
@on_close.call if @on_close
end
@io.on_close do
on_close.call
end
end

def close
Expand Down

0 comments on commit 394b3e8

Please sign in to comment.