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.416 by root, Fri Apr 11 13:59:06 2008 UTC vs.
Revision 1.418 by root, Fri Apr 11 21:09:53 2008 UTC

1775our $MAX_RESET = 3600; 1775our $MAX_RESET = 3600;
1776our $DEFAULT_RESET = 3000; 1776our $DEFAULT_RESET = 3000;
1777 1777
1778sub generate_random_map { 1778sub generate_random_map {
1779 my ($self, $rmp) = @_; 1779 my ($self, $rmp) = @_;
1780
1781 my $lock = cf::lock_acquire "generate_random_map"; # the random map generator is NOT reentrant ATM
1782
1780 # mit "rum" bekleckern, nicht 1783 # mit "rum" bekleckern, nicht
1781 $self->_create_random_map ( 1784 $self->_create_random_map (
1782 $rmp->{wallstyle}, $rmp->{wall_name}, $rmp->{floorstyle}, $rmp->{monsterstyle}, 1785 $rmp->{wallstyle}, $rmp->{wall_name}, $rmp->{floorstyle}, $rmp->{monsterstyle},
1783 $rmp->{treasurestyle}, $rmp->{layoutstyle}, $rmp->{doorstyle}, $rmp->{decorstyle}, 1786 $rmp->{treasurestyle}, $rmp->{layoutstyle}, $rmp->{doorstyle}, $rmp->{decorstyle},
1784 $rmp->{origin_map}, $rmp->{final_map}, $rmp->{exitstyle}, $rmp->{this_map}, 1787 $rmp->{origin_map}, $rmp->{final_map}, $rmp->{exitstyle}, $rmp->{this_map},
3404 cf::cleanup "SIG$signal"; 3407 cf::cleanup "SIG$signal";
3405 }; 3408 };
3406 } 3409 }
3407} 3410}
3408 3411
3409sub write_runtime { 3412sub write_runtime_sync {
3410 my $runtime = "$LOCALDIR/runtime"; 3413 my $runtime = "$LOCALDIR/runtime";
3411 3414
3412 # first touch the runtime file to show we are still running: 3415 # first touch the runtime file to show we are still running:
3413 # the fsync below can take a very very long time. 3416 # the fsync below can take a very very long time.
3414 3417
3542 warn "reloading..."; 3545 warn "reloading...";
3543 3546
3544 warn "entering sync_job"; 3547 warn "entering sync_job";
3545 3548
3546 cf::sync_job { 3549 cf::sync_job {
3547 cf::write_runtime; # external watchdog should not bark 3550 cf::write_runtime_sync; # external watchdog should not bark
3548 cf::emergency_save; 3551 cf::emergency_save;
3549 cf::write_runtime; # external watchdog should not bark 3552 cf::write_runtime_sync; # external watchdog should not bark
3550 3553
3551 warn "syncing database to disk"; 3554 warn "syncing database to disk";
3552 BDB::db_env_txn_checkpoint $DB_ENV; 3555 BDB::db_env_txn_checkpoint $DB_ENV;
3553 3556
3554 # if anything goes wrong in here, we should simply crash as we already saved 3557 # if anything goes wrong in here, we should simply crash as we already saved
3709 3712
3710 if ($NOW >= $NEXT_RUNTIME_WRITE) { 3713 if ($NOW >= $NEXT_RUNTIME_WRITE) {
3711 $NEXT_RUNTIME_WRITE = List::Util::max $NEXT_RUNTIME_WRITE + 10, $NOW + 5.; 3714 $NEXT_RUNTIME_WRITE = List::Util::max $NEXT_RUNTIME_WRITE + 10, $NOW + 5.;
3712 Coro::async_pool { 3715 Coro::async_pool {
3713 $Coro::current->{desc} = "runtime saver"; 3716 $Coro::current->{desc} = "runtime saver";
3714 write_runtime 3717 write_runtime_sync
3715 or warn "ERROR: unable to write runtime file: $!"; 3718 or warn "ERROR: unable to write runtime file: $!";
3716 }; 3719 };
3717 } 3720 }
3718 3721
3719 if (my $sig = shift @WAIT_FOR_TICK_BEGIN) { 3722 if (my $sig = shift @WAIT_FOR_TICK_BEGIN) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines