--- deliantra/server/lib/cf.pm 2006/12/11 22:56:57 1.85 +++ deliantra/server/lib/cf.pm 2006/12/15 19:59:20 1.89 @@ -18,6 +18,8 @@ use strict; +sub WF_AUTOCANCEL () { 1 } # automatically cancel this watcher on reload + our %COMMAND = (); our %COMMAND_TIME = (); our %EXTCMD = (); @@ -25,7 +27,7 @@ _init_vars; our @EVENT; -our $LIBDIR = maps_directory "perl"; +our $LIBDIR = datadir . "/ext"; our $TICK = MAX_TIME * 1e-6; our $TICK_WATCHER; @@ -78,7 +80,12 @@ # we bless all objects into (empty) derived classes to force a method lookup # within the Safe compartment. -for my $pkg (qw(cf::object cf::object::player cf::player cf::map cf::party cf::region cf::arch cf::living)) { +for my $pkg (qw( + cf::object cf::object::player + cf::client cf::player + cf::arch cf::living + cf::map cf::party cf::region +)) { no strict 'refs'; @{"safe::$pkg\::wrap::ISA"} = @{"$pkg\::wrap::ISA"} = $pkg; } @@ -715,8 +722,6 @@ } sub load_extensions { - my $LIBDIR = maps_directory "perl"; - for my $ext (<$LIBDIR/*.ext>) { next unless -r $ext; eval { @@ -1020,7 +1025,7 @@ undef $dirty; } - my $idle = Event->idle (min => $TICK * 2.8, max => 10, repeat => 0, cb => sub { + my $idle = Event->idle (min => $TICK * 2.8, max => 10, repeat => 0, data => WF_AUTOCANCEL, cb => sub { db_sync; }); @@ -1080,7 +1085,9 @@ eval { # cancel all watchers - $_->cancel for Event::all_watchers; + for (Event::all_watchers) { + $_->cancel if $_->data & WF_AUTOCANCEL; + } # unload all extensions for (@exts) { @@ -1169,6 +1176,7 @@ prio => 1, async => 1, at => $NEXT_TICK || 1, + data => WF_AUTOCANCEL, cb => sub { cf::server_tick; # one server iteration @@ -1188,6 +1196,7 @@ Event->io (fd => IO::AIO::poll_fileno, poll => 'r', prio => 5, + data => WF_AUTOCANCEL, cb => \&IO::AIO::poll_cb); 1