- if (cfg_time >= 0) {
- int host = cfg_host;
- int link = cfg_link;
- xbt_assert(host >= 0 || link >= 0,
- "If a kill time is given, you must also specify a resource to kill (either a link or an host)");
- xbt_assert(host < 0 || link < 0, "Cannot specify both a link and an host to kill");
- if (host >= 0) {
- auto* h = hosts[host];
- simgrid::kernel::timer::Timer::set(cfg_time, [h]() {
- XBT_INFO("Kill host %s", h->get_cname());
- h->turn_off();
- });
- simgrid::kernel::timer::Timer::set(cfg_time + 30, [h]() {
- XBT_INFO("Restart host %s", h->get_cname());
- h->turn_on();
- });
- }
- if (link >= 0) {
- auto* l = links[link];
- simgrid::kernel::timer::Timer::set(cfg_time, [l]() {
- XBT_INFO("Kill link %s", l->get_cname());
- l->turn_off();
- });
- simgrid::kernel::timer::Timer::set(cfg_time + 30, [l]() {
- XBT_INFO("Restart host %s", l->get_cname());
- l->turn_on();
- });
- }
+ if (cfg_time >= 0) {
+ int host = cfg_host;
+ int link = cfg_link;
+ xbt_assert(host >= 0 || link >= 0,
+ "If a kill time is given, you must also specify a resource to kill (either a link or an host)");
+ xbt_assert(host < 0 || link < 0, "Cannot specify both a link and an host to kill");
+ if (host >= 0) {
+ auto* h = hosts.at(host);
+ simgrid::kernel::timer::Timer::set(cfg_time, [h]() {
+ XBT_INFO("Kill host %s", h->get_cname());
+ h->turn_off();
+ });
+ simgrid::kernel::timer::Timer::set(cfg_time + 30, [h]() {
+ XBT_INFO("Restart host %s", h->get_cname());
+ h->turn_on();
+ });
+ }
+ if (link >= 0) {
+ auto* l = links.at(link);
+ simgrid::kernel::timer::Timer::set(cfg_time, [l]() {
+ XBT_INFO("Kill link %s", l->get_cname());
+ l->turn_off();
+ });
+ simgrid::kernel::timer::Timer::set(cfg_time + 30, [l]() {
+ XBT_INFO("Restart host %s", l->get_cname());
+ l->turn_on();
+ });