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.215 by root, Thu Feb 15 03:19:02 2007 UTC vs.
Revision 1.217 by root, Thu Feb 15 21:07:49 2007 UTC

785 } 785 }
786 } else { 786 } else {
787 aio_unlink $filename; 787 aio_unlink $filename;
788 aio_unlink "$filename.pst"; 788 aio_unlink "$filename.pst";
789 } 789 }
790
791 #d##TODO# nuke non .map-files if exist
792 if ($filename =~ s/\.map$//) {
793 aio_unlink $filename;
794 aio_unlink "$filename.pst";
795 }
796 } 790 }
797} 791}
798 792
799sub object_freezer_as_string { 793sub object_freezer_as_string {
800 my ($rdata, $objs) = @_; 794 my ($rdata, $objs) = @_;
806 800
807sub object_thawer_load { 801sub object_thawer_load {
808 my ($filename) = @_; 802 my ($filename) = @_;
809 803
810 my ($data, $av); 804 my ($data, $av);
811
812 #d#TODO remove .map if file does not exist
813 aio_stat $filename and $filename =~ s/\.map$//;
814 805
815 (aio_load $filename, $data) >= 0 806 (aio_load $filename, $data) >= 0
816 or return; 807 or return;
817 808
818 unless (aio_stat "$filename.pst") { 809 unless (aio_stat "$filename.pst") {
1305 my ($self) = @_; 1296 my ($self) = @_;
1306 1297
1307 utf8::encode (my $save = $self->save_path); 1298 utf8::encode (my $save = $self->save_path);
1308 IO::AIO::aioreq_pri 4; Coro::AIO::aio_unlink $save; 1299 IO::AIO::aioreq_pri 4; Coro::AIO::aio_unlink $save;
1309 IO::AIO::aioreq_pri 4; Coro::AIO::aio_unlink "$save.pst"; 1300 IO::AIO::aioreq_pri 4; Coro::AIO::aio_unlink "$save.pst";
1310
1311 #d#TODO remove .map and also nuke
1312 $save =~ s/\.map// or return;#d#
1313 IO::AIO::aioreq_pri 4; Coro::AIO::aio_unlink $save;#d#
1314 IO::AIO::aioreq_pri 4; Coro::AIO::aio_unlink "$save.pst";#d#
1315} 1301}
1316 1302
1317sub load_header_from($) { 1303sub load_header_from($) {
1318 my ($self, $path) = @_; 1304 my ($self, $path) = @_;
1319 1305
2256} 2242}
2257 2243
2258############################################################################# 2244#############################################################################
2259# the server's init and main functions 2245# the server's init and main functions
2260 2246
2261sub load_resources { 2247sub init_resources {
2262 load_regions sprintf "%s/%s/regions", cf::datadir, cf::mapdir 2248 load_resource_file sprintf "%s/%s/regions", cf::datadir, cf::mapdir
2263 or die "unable to load regions file\n";#d# 2249 or die "unable to load regions file\n";#d#
2264} 2250}
2265 2251
2266sub cfg_load { 2252sub cfg_load {
2267 open my $fh, "<:utf8", cf::confdir . "/config" 2253 open my $fh, "<:utf8", cf::confdir . "/config"
2283 warn $@ if $@; 2269 warn $@ if $@;
2284 } 2270 }
2285} 2271}
2286 2272
2287sub init { 2273sub init {
2288 load_resources; 2274 init_resources;
2289} 2275}
2290 2276
2291sub main { 2277sub main {
2292 # we must not ever block the main coroutine 2278 # we must not ever block the main coroutine
2293 local $Coro::idle = sub { 2279 local $Coro::idle = sub {
2467 _global_reattach; 2453 _global_reattach;
2468 warn "reattaching attachments to maps"; 2454 warn "reattaching attachments to maps";
2469 reattach $_ for values %MAP; 2455 reattach $_ for values %MAP;
2470 2456
2471 warn "loading reloadable resources"; 2457 warn "loading reloadable resources";
2472 load_resources; 2458 init_resources;
2473 2459
2474 warn "leaving sync_job"; 2460 warn "leaving sync_job";
2475 2461
2476 1 2462 1
2477 } or do { 2463 } or do {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines