… | |
… | |
116 | # delete a player directory, be non-blocking AND synchronous... |
116 | # delete a player directory, be non-blocking AND synchronous... |
117 | # (thats hard, so we crap out and fork). |
117 | # (thats hard, so we crap out and fork). |
118 | sub nuke_playerdir { |
118 | sub nuke_playerdir { |
119 | my ($user) = @_; |
119 | my ($user) = @_; |
120 | |
120 | |
121 | aio_stat "$PLAYERDIR/$user"; |
121 | my $temp = "$PLAYERDIR/~$Coro::current~deleting~"; |
122 | system "cd \Q$PLAYERDIR\E " |
122 | |
123 | . "&& mv \Q$user\E ~\Q$Coro::current\E~deleting~ 2>/dev/null " |
123 | cf::fork_call { |
124 | . "&& (rm -rf ~\Q$Coro::current\E~deleting~ &)"; |
124 | rename "$PLAYERDIR/$user", $temp; |
|
|
125 | system "rm", "-rf", $temp; |
|
|
126 | }; |
125 | } |
127 | } |
126 | |
128 | |
127 | cf::client->attach (on_addme => sub { |
129 | cf::client->attach (on_addme => sub { |
128 | my ($ns) = @_; |
130 | my ($ns) = @_; |
129 | |
131 | |
… | |
… | |
142 | *** |
144 | *** |
143 | *** CFPlus: all known versions automatically enable the facecache. |
145 | *** CFPlus: all known versions automatically enable the facecache. |
144 | *** cfclient: use the -cache commandline option. |
146 | *** cfclient: use the -cache commandline option. |
145 | *** cfclient: map will not redraw automatically (bug). |
147 | *** cfclient: map will not redraw automatically (bug). |
146 | *** gcfclient: use -cache commandline option, or enable |
148 | *** gcfclient: use -cache commandline option, or enable |
147 | *** gcfclient: Client=>Configure=>Map & Image=>Cache Images. |
149 | *** gcfclient: Client => Configure => Map & Image => Cache Images. |
148 | *** jcrossclient: your client is broken, use CFPlus or gcfclient. |
150 | *** jcrossclient: your client is broken, use CFPlus or gcfclient. |
149 | *** |
151 | *** |
150 | *** |
152 | *** |
151 | EOF |
153 | EOF |
152 | if ($ns->version =~ /jcrossclient/) { |
154 | if ($ns->version =~ /jcrossclient/) { |
… | |
… | |
477 | }, |
479 | }, |
478 | ); |
480 | ); |
479 | |
481 | |
480 | ############################################################################# |
482 | ############################################################################# |
481 | |
483 | |
482 | our $SCHEDULE_INTERVAL = 10; # time the player scheduler sleeps between runs |
484 | our $SCHEDULE_INTERVAL = $cf::CFG{player_schedule_interval} || 10; # time the player scheduler sleeps between runs |
483 | our $SAVE_TIMEOUT = 20; # save players every n seconds |
485 | our $SAVE_TIMEOUT = $cf::CFG{player_save_interval} || 20; # save players every n seconds |
484 | |
486 | |
485 | our $SCHEDULER = cf::async_ext { |
487 | our $SCHEDULER = cf::async_ext { |
486 | my $schedule_interval = Coro::Event->timer (after => 1); |
488 | my $schedule_interval = Coro::Event->timer (after => 1); |
487 | while () { |
489 | while () { |
488 | $schedule_interval->interval ($SCHEDULE_INTERVAL); |
490 | $schedule_interval->interval ($SCHEDULE_INTERVAL); |
… | |
… | |
498 | or next; |
500 | or next; |
499 | $pl->valid or next; |
501 | $pl->valid or next; |
500 | |
502 | |
501 | eval { |
503 | eval { |
502 | if ($pl->{last_save} + $SAVE_TIMEOUT <= $cf::RUNTIME) { |
504 | if ($pl->{last_save} + $SAVE_TIMEOUT <= $cf::RUNTIME) { |
503 | cf::wait_for_tick_begin; |
|
|
504 | $pl->save; |
505 | $pl->save; |
505 | |
506 | |
506 | unless ($pl->active || $pl->ns) { |
507 | unless ($pl->active || $pl->ns) { |
507 | # check refcounts, this is tricky and needs to be adjusted to fit server internals |
508 | # check refcounts, this is tricky and needs to be adjusted to fit server internals |
508 | my $ob = $pl->ob; |
509 | my $ob = $pl->ob; |