class Pione::Front::DiagnosisNotificationFront

‘DiagnosisNotificationFront` is a front server for diagnosis test about sending notifications.

Constants

LOCK

Public Class Methods

new(cmd) click to toggle source
Calls superclass method Pione::Front::BasicFront::new
# File lib/pione/front/diagnosis-notification-front.rb, line 8
def initialize(cmd)
  super(cmd, Global.diagnosis_notification_front_port_range)
  @transmitting_threads = ThreadGroup.new
end

Public Instance Methods

register_transmitting_thread(thread) click to toggle source

Register the transmitting thread for test.

@param thread [Thread]

a transmitting thread,
see `Pione::Command::PioneDiagnosisNotification`

@return [void]

# File lib/pione/front/diagnosis-notification-front.rb, line 35
def register_transmitting_thread(thread)
  LOCK.synchronize {@transmitting_threads.add(thread)}
end
touch(transmitter_id) click to toggle source

If the front is touched, notification diagnosis is success.

@param transmitter_id [String]

transmitter ID, this is a string of transmitter's target URI

@return [void]

# File lib/pione/front/diagnosis-notification-front.rb, line 18
def touch(transmitter_id)
  LOCK.synchronize do
    @transmitting_threads.list.each do |thread|
      if thread[:transmitter_id] == transmitter_id and thread.alive?
        thread.terminate
      end
    end
  end
  return true
end