… | |
… | |
192 | LOG llevError, $msg; |
192 | LOG llevError, $msg; |
193 | }; |
193 | }; |
194 | } |
194 | } |
195 | |
195 | |
196 | $Coro::State::DIEHOOK = sub { |
196 | $Coro::State::DIEHOOK = sub { |
|
|
197 | return unless $^S eq 0; # "eq", not "==" |
|
|
198 | |
|
|
199 | if ($Coro::current == $Coro::main) {#d# |
|
|
200 | warn "DIEHOOK called in main context, Coro bug?\n";#d# |
|
|
201 | return;#d# |
|
|
202 | }#d# |
|
|
203 | |
|
|
204 | # kill coroutine otherwise |
197 | warn Carp::longmess $_[0]; |
205 | warn Carp::longmess $_[0]; |
198 | Coro::terminate; |
206 | Coro::terminate |
199 | }; |
207 | }; |
|
|
208 | |
|
|
209 | $SIG{__DIE__} = sub { }; #d#? |
200 | |
210 | |
201 | @safe::cf::global::ISA = @cf::global::ISA = 'cf::attachable'; |
211 | @safe::cf::global::ISA = @cf::global::ISA = 'cf::attachable'; |
202 | @safe::cf::object::ISA = @cf::object::ISA = 'cf::attachable'; |
212 | @safe::cf::object::ISA = @cf::object::ISA = 'cf::attachable'; |
203 | @safe::cf::player::ISA = @cf::player::ISA = 'cf::attachable'; |
213 | @safe::cf::player::ISA = @cf::player::ISA = 'cf::attachable'; |
204 | @safe::cf::client::ISA = @cf::client::ISA = 'cf::attachable'; |
214 | @safe::cf::client::ISA = @cf::client::ISA = 'cf::attachable'; |
… | |
… | |
1306 | my $msg = $@ ? "$v->{path}: $@\n" |
1316 | my $msg = $@ ? "$v->{path}: $@\n" |
1307 | : "$v->{base}: extension inactive.\n"; |
1317 | : "$v->{base}: extension inactive.\n"; |
1308 | |
1318 | |
1309 | if (exists $v->{meta}{mandatory}) { |
1319 | if (exists $v->{meta}{mandatory}) { |
1310 | warn $msg; |
1320 | warn $msg; |
1311 | warn "mandatory extension failed to load, exiting.\n"; |
1321 | cf::cleanup "mandatory extension failed to load, exiting."; |
1312 | exit 1; |
|
|
1313 | } |
1322 | } |
1314 | |
1323 | |
1315 | warn $msg; |
1324 | warn $msg; |
1316 | } |
1325 | } |
1317 | |
1326 | |
… | |
… | |
3548 | warn "leaving sync_job"; |
3557 | warn "leaving sync_job"; |
3549 | |
3558 | |
3550 | 1 |
3559 | 1 |
3551 | } or do { |
3560 | } or do { |
3552 | warn $@; |
3561 | warn $@; |
3553 | warn "error while reloading, exiting."; |
3562 | cf::cleanup "error while reloading, exiting."; |
3554 | exit 1; |
|
|
3555 | }; |
3563 | }; |
3556 | |
3564 | |
3557 | warn "reloaded"; |
3565 | warn "reloaded"; |
3558 | }; |
3566 | }; |
3559 | |
3567 | |
… | |
… | |
3562 | sub reload_perl() { |
3570 | sub reload_perl() { |
3563 | # doing reload synchronously and two reloads happen back-to-back, |
3571 | # doing reload synchronously and two reloads happen back-to-back, |
3564 | # coro crashes during coro_state_free->destroy here. |
3572 | # coro crashes during coro_state_free->destroy here. |
3565 | |
3573 | |
3566 | $RELOAD_WATCHER ||= EV::timer 0, 0, sub { |
3574 | $RELOAD_WATCHER ||= EV::timer 0, 0, sub { |
|
|
3575 | do_reload_perl; |
3567 | undef $RELOAD_WATCHER; |
3576 | undef $RELOAD_WATCHER; |
3568 | do_reload_perl; |
|
|
3569 | }; |
3577 | }; |
3570 | } |
3578 | } |
3571 | |
3579 | |
3572 | register_command "reload" => sub { |
3580 | register_command "reload" => sub { |
3573 | my ($who, $arg) = @_; |
3581 | my ($who, $arg) = @_; |