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.127 by root, Wed Jan 3 00:05:26 2007 UTC vs.
Revision 1.131 by root, Thu Jan 4 00:53:54 2007 UTC

71mkdir cf::localdir . "/" . cf::uniquedir; 71mkdir cf::localdir . "/" . cf::uniquedir;
72mkdir $RANDOM_MAPS; 72mkdir $RANDOM_MAPS;
73 73
74# a special map that is always available 74# a special map that is always available
75our $LINK_MAP; 75our $LINK_MAP;
76 76our $EMERGENCY_POSITION;
77our $EMERGENCY_POSITION = $cf::CFG{emergency_position} || ["/world/world_105_115", 5, 37];
78 77
79############################################################################# 78#############################################################################
80 79
81=head2 GLOBAL VARIABLES 80=head2 GLOBAL VARIABLES
82 81
1322} 1321}
1323 1322
1324sub swap_out { 1323sub swap_out {
1325 my ($self) = @_; 1324 my ($self) = @_;
1326 1325
1326 # save first because save cedes
1327 $self->save;
1328
1327 return if $self->players; 1329 return if $self->players;
1328 return if $self->in_memory != cf::MAP_IN_MEMORY; 1330 return if $self->in_memory != cf::MAP_IN_MEMORY;
1329 return if $self->{deny_save}; 1331 return if $self->{deny_save};
1330 1332
1331 $self->save;
1332 $self->clear; 1333 $self->clear;
1333 $self->in_memory (cf::MAP_SWAPPED); 1334 $self->in_memory (cf::MAP_SWAPPED);
1334} 1335}
1335 1336
1336sub reset_at { 1337sub reset_at {
1713 on_reply => sub { 1714 on_reply => sub {
1714 my ($ns, $msg) = @_; 1715 my ($ns, $msg) = @_;
1715 1716
1716 # this weird shuffling is so that direct followup queries 1717 # this weird shuffling is so that direct followup queries
1717 # get handled first 1718 # get handled first
1718 my $queue = delete $ns->{query_queue}; 1719 my $queue = delete $ns->{query_queue}
1720 or return; # be conservative, not sure how that can happen, but we saw a crash here
1719 1721
1720 (shift @$queue)->[1]->($msg); 1722 (shift @$queue)->[1]->($msg);
1721 1723
1722 push @{ $ns->{query_queue} }, @$queue; 1724 push @{ $ns->{query_queue} }, @$queue;
1723 1725
1985 open my $fh, "<:utf8", cf::confdir . "/config" 1987 open my $fh, "<:utf8", cf::confdir . "/config"
1986 or return; 1988 or return;
1987 1989
1988 local $/; 1990 local $/;
1989 *CFG = YAML::Syck::Load <$fh>; 1991 *CFG = YAML::Syck::Load <$fh>;
1992
1993 $EMERGENCY_POSITION = $CFG{emergency_position} || ["/world/world_105_115", 5, 37];
1994
1995 if (exists $CFG{mlockall}) {
1996 eval {
1997 $CFG{mlockall} ? &mlockall : &munlockall
1998 and die "WARNING: m(un)lockall failed: $!\n";
1999 };
2000 warn $@ if $@;
2001 }
1990} 2002}
1991 2003
1992sub main { 2004sub main {
1993 # we must not ever block the main coroutine 2005 # we must not ever block the main coroutine
1994 local $Coro::idle = sub { 2006 local $Coro::idle = sub {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines