Navigation Menu

Skip to content

Commit

Permalink
Forbid to forward after shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Apr 1, 2015
1 parent 6a340b0 commit 789696c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/droonga/forwarder.rb
Expand Up @@ -23,9 +23,13 @@ module Droonga
class Forwarder
include Loggable

class AlreadyShutdown < Error
end

def initialize(loop, options={})
@loop = loop
@senders = {}
@shutting_down = false
end

def start
Expand All @@ -35,6 +39,7 @@ def start

def shutdown
logger.trace("shutdown: start")
@shutting_down = true
@senders.each_value do |sender|
sender.shutdown
end
Expand All @@ -43,6 +48,7 @@ def shutdown

def forward(message, destination)
logger.trace("forward: start")
raise AlreadyShutdown.new if @shutting_down
command = destination["type"]
receiver = destination["to"]
arguments = destination["arguments"]
Expand Down

0 comments on commit 789696c

Please sign in to comment.