Method: Roma::Command::SystemCommandReceiver#ev_switch_failover

Defined in:
lib/roma/command/sys_command_receiver.rb

#ev_switch_failover(s) ⇒ Object

switch_failover <on|off>



373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
# File 'lib/roma/command/sys_command_receiver.rb', line 373

def ev_switch_failover(s)
  if s.length != 2
    return send_data("CLIENT_ERROR number of arguments\r\n")
  end
  res = broadcast_cmd("rswitch_failover #{s[1]}\r\n")
  if s[1] == 'on'
    Messaging::ConPool.instance.close_all
    Event::EMConPool::instance.close_all
    @rttable.enabled_failover = true
    @log.info("failover enabled")
    res[@stats.ap_str] = "ENABLED"
  elsif s[1] == 'off'
    @rttable.enabled_failover = false
    @log.info("failover disabled")
    res[@stats.ap_str] = "DISABLED"
  else
    res[@stats.ap_str] = "NOTSWITCHED"
  end
  send_data("#{res}\r\n")
end