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.201 by root, Mon Jan 29 18:15:23 2007 UTC vs.
Revision 1.203 by root, Thu Feb 1 19:40:42 2007 UTC

2003 # get handled first 2003 # get handled first
2004 my $queue = delete $ns->{query_queue} 2004 my $queue = delete $ns->{query_queue}
2005 or return; # be conservative, not sure how that can happen, but we saw a crash here 2005 or return; # be conservative, not sure how that can happen, but we saw a crash here
2006 2006
2007 (shift @$queue)->[1]->($msg); 2007 (shift @$queue)->[1]->($msg);
2008 return unless $ns->valid; # temporary(?) workaround for callback destroying socket
2008 2009
2009 push @{ $ns->{query_queue} }, @$queue; 2010 push @{ $ns->{query_queue} }, @$queue;
2010 2011
2011 if (@{ $ns->{query_queue} } == @$queue) { 2012 if (@{ $ns->{query_queue} } == @$queue) {
2012 if (@$queue) { 2013 if (@$queue) {
2269 }, 2270 },
2270 ); 2271 );
2271} 2272}
2272 2273
2273############################################################################# 2274#############################################################################
2274# the server's main() 2275# the server's init and main functions
2276
2277sub load_resources {
2278 load_regions sprintf "%s/%s/regions", cf::datadir, cf::mapdir
2279 or die "unable to load regions file\n";#d#
2280}
2275 2281
2276sub cfg_load { 2282sub cfg_load {
2277 open my $fh, "<:utf8", cf::confdir . "/config" 2283 open my $fh, "<:utf8", cf::confdir . "/config"
2278 or return; 2284 or return;
2279 2285
2290 $CFG{mlockall} ? eval "mlockall()" : eval "munlockall()" 2296 $CFG{mlockall} ? eval "mlockall()" : eval "munlockall()"
2291 and die "WARNING: m(un)lockall failed: $!\n"; 2297 and die "WARNING: m(un)lockall failed: $!\n";
2292 }; 2298 };
2293 warn $@ if $@; 2299 warn $@ if $@;
2294 } 2300 }
2301}
2302
2303sub init {
2304 load_resources;
2295} 2305}
2296 2306
2297sub main { 2307sub main {
2298 # we must not ever block the main coroutine 2308 # we must not ever block the main coroutine
2299 local $Coro::idle = sub { 2309 local $Coro::idle = sub {
2460 warn "reattaching attachments to objects/players"; 2470 warn "reattaching attachments to objects/players";
2461 _global_reattach; 2471 _global_reattach;
2462 warn "reattaching attachments to maps"; 2472 warn "reattaching attachments to maps";
2463 reattach $_ for values %MAP; 2473 reattach $_ for values %MAP;
2464 2474
2475 warn "loading reloadable resources";
2476 load_resources;
2477
2465 warn "restarting server ticker"; 2478 warn "restarting server ticker";
2466 2479
2467 $TICK_WATCHER->start; 2480 $TICK_WATCHER->start;
2468 }; 2481 };
2469 2482

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines