ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/login.ext
(Generate patch)

Comparing deliantra/server/ext/login.ext (file contents):
Revision 1.23 by root, Tue Jan 9 15:36:18 2007 UTC vs.
Revision 1.24 by root, Tue Jan 9 21:32:42 2007 UTC

341 341
342############################################################################# 342#############################################################################
343 343
344our $SCHEDULE_INTERVAL = 10; # time the player scheduler sleeps between runs 344our $SCHEDULE_INTERVAL = 10; # time the player scheduler sleeps between runs
345our $SAVE_TIMEOUT = 20; # save players every n seconds 345our $SAVE_TIMEOUT = 20; # save players every n seconds
346our $SAVE_INTERVAL = 0.5; # save at max. one player every $SAVE_INTERVAL
347 346
348our $SCHEDULER = cf::async_ext { 347our $SCHEDULER = cf::async_ext {
349 while () { 348 while () {
350 Coro::Timer::sleep $SCHEDULE_INTERVAL; 349 Coro::Timer::sleep $SCHEDULE_INTERVAL;
351 350
359 or next; 358 or next;
360 $pl->valid or next; 359 $pl->valid or next;
361 360
362 eval { 361 eval {
363 if ($pl->{last_save} + $SAVE_TIMEOUT <= $cf::RUNTIME) { 362 if ($pl->{last_save} + $SAVE_TIMEOUT <= $cf::RUNTIME) {
363 $cf::WAIT_FOR_TICK_ONE->wait;
364 $pl->save; 364 $pl->save;
365 365
366 unless ($pl->active) { 366 unless ($pl->active) {
367 # check refcounts, this is tricky and needs to be adjusted to fit server internals 367 # check refcounts, this is tricky and needs to be adjusted to fit server internals
368 my $ob = $pl->ob; 368 my $ob = $pl->ob;
386 $pl->destroy; 386 $pl->destroy;
387 } else { 387 } else {
388 warn "player-scheduler refcnt ", $ob->name, " $pl_ref,$a_ $ob_ref,$b_\n";#d# 388 warn "player-scheduler refcnt ", $ob->name, " $pl_ref,$a_ $ob_ref,$b_\n";#d#
389 } 389 }
390 } 390 }
391 Coro::Timer::sleep $SAVE_INTERVAL;
392 } 391 }
393 }; 392 };
394 warn $@ if $@; 393 warn $@ if $@;
395 Coro::cede; 394 Coro::cede;
396 }; 395 };

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines