ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/lib/cf.pm
(Generate patch)

Comparing deliantra/server/lib/cf.pm (file contents):
Revision 1.344 by root, Mon Aug 27 02:43:38 2007 UTC vs.
Revision 1.345 by root, Tue Aug 28 19:30:11 2007 UTC

1849 local $self->{deny_reset} = 1; # loading can take a long time 1849 local $self->{deny_reset} = 1; # loading can take a long time
1850 1850
1851 my $path = $self->{path}; 1851 my $path = $self->{path};
1852 1852
1853 { 1853 {
1854 my $guard1 = cf::lock_acquire "map_data:$path";
1854 my $guard = cf::lock_acquire "map_load:$path"; 1855 my $guard2 = cf::lock_acquire "map_load:$path";
1855 1856
1856 return if $self->in_memory != cf::MAP_SWAPPED; 1857 return if $self->in_memory != cf::MAP_SWAPPED;
1857 1858
1858 $self->in_memory (cf::MAP_LOADING); 1859 $self->in_memory (cf::MAP_LOADING);
1859 1860
1987} 1988}
1988 1989
1989sub save { 1990sub save {
1990 my ($self) = @_; 1991 my ($self) = @_;
1991 1992
1992 my $lock = cf::lock_acquire "map_data:" . $self->path; 1993 my $lock = cf::lock_acquire "map_data:$self->{path}";
1993 1994
1994 $self->{last_save} = $cf::RUNTIME; 1995 $self->{last_save} = $cf::RUNTIME;
1995 1996
1996 return unless $self->dirty; 1997 return unless $self->dirty;
1997 1998
2020 my ($self) = @_; 2021 my ($self) = @_;
2021 2022
2022 # save first because save cedes 2023 # save first because save cedes
2023 $self->save; 2024 $self->save;
2024 2025
2025 my $lock = cf::lock_acquire "map_data:" . $self->path; 2026 my $lock = cf::lock_acquire "map_data:$self->{path}";
2026 2027
2027 return if $self->players; 2028 return if $self->players;
2028 return if $self->in_memory != cf::MAP_IN_MEMORY; 2029 return if $self->in_memory != cf::MAP_IN_MEMORY;
2029 return if $self->{deny_save}; 2030 return if $self->{deny_save};
2030 2031
2997 2998
2998sub init { 2999sub init {
2999 reload_resources; 3000 reload_resources;
3000} 3001}
3001 3002
3002sub cfg_load { 3003sub reload_config {
3003 open my $fh, "<:utf8", "$CONFDIR/config" 3004 open my $fh, "<:utf8", "$CONFDIR/config"
3004 or return; 3005 or return;
3005 3006
3006 local $/; 3007 local $/;
3007 *CFG = YAML::Syck::Load <$fh>; 3008 *CFG = YAML::Syck::Load <$fh>;
3027 (async { 3028 (async {
3028 Event::one_event; 3029 Event::one_event;
3029 })->prio (Coro::PRIO_MAX); 3030 })->prio (Coro::PRIO_MAX);
3030 }; 3031 };
3031 3032
3032 cfg_load; 3033 reload_config;
3033 db_init; 3034 db_init;
3034 load_extensions; 3035 load_extensions;
3035 3036
3036 $TICK_WATCHER->start; 3037 $TICK_WATCHER->start;
3037 Event::loop; 3038 Event::loop;
3230 warn "reloading cf.pm"; 3231 warn "reloading cf.pm";
3231 require cf; 3232 require cf;
3232 cf::_connect_to_perl; # nominally unnecessary, but cannot hurt 3233 cf::_connect_to_perl; # nominally unnecessary, but cannot hurt
3233 3234
3234 warn "loading config and database again"; 3235 warn "loading config and database again";
3235 cf::cfg_load; 3236 cf::reload_config;
3236 3237
3237 warn "loading extensions"; 3238 warn "loading extensions";
3238 cf::load_extensions; 3239 cf::load_extensions;
3239 3240
3240 warn "reattaching attachments to objects/players"; 3241 warn "reattaching attachments to objects/players";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines