… | |
… | |
158 | nuke_str $pass; |
158 | nuke_str $pass; |
159 | # password matches, wonderful |
159 | # password matches, wonderful |
160 | my $pl = cf::player::find $user or next; |
160 | my $pl = cf::player::find $user or next; |
161 | $pl->connect ($ns); |
161 | $pl->connect ($ns); |
162 | check_clean_save $pl; |
162 | check_clean_save $pl; |
|
|
163 | $pl->{clean_save} = 1; |
163 | last; |
164 | last; |
164 | } elsif (can_cleanup $buf, $mtime) { |
165 | } elsif (can_cleanup $buf, $mtime) { |
165 | Coro::Timer::sleep 1; |
166 | Coro::Timer::sleep 1; |
166 | |
167 | |
167 | $ns->send_drawinfo ( |
168 | $ns->send_drawinfo ( |
… | |
… | |
307 | if ($_[0] !~ /^[yY]/) { |
308 | if ($_[0] !~ /^[yY]/) { |
308 | $pl->invoke (cf::EVENT_PLAYER_LOGOUT, 1); |
309 | $pl->invoke (cf::EVENT_PLAYER_LOGOUT, 1); |
309 | $pl->deactivate; |
310 | $pl->deactivate; |
310 | $pl->ns->destroy; |
311 | $pl->ns->destroy; |
311 | } else { |
312 | } else { |
312 | cf::async { |
313 | cf::async { $pl->save }; |
313 | $pl->{clean_save} = 1; |
|
|
314 | $pl->save; |
|
|
315 | }; |
|
|
316 | } |
314 | } |
317 | }); |
315 | }); |
318 | }, |
316 | }, |
319 | ); |
317 | ); |
320 | |
318 | |
… | |
… | |
365 | eval { |
363 | eval { |
366 | if ($pl->{last_save} + $SAVE_TIMEOUT <= $cf::RUNTIME) { |
364 | if ($pl->{last_save} + $SAVE_TIMEOUT <= $cf::RUNTIME) { |
367 | $pl->save; |
365 | $pl->save; |
368 | Coro::Timer::sleep $SAVE_INTERVAL; |
366 | Coro::Timer::sleep $SAVE_INTERVAL; |
369 | } |
367 | } |
|
|
368 | my $ob = $pl->ob; |
|
|
369 | Scalar::Util::weaken $pl; # 2 == from object + from perl |
|
|
370 | Scalar::Util::weaken $ob; # 2 == one from being an object + ??? |
|
|
371 | my $a_ = $pl->refcnt; |
|
|
372 | my $b_ = $ob->refcnt; |
|
|
373 | my $a = $pl->refcnt_cnt; |
|
|
374 | my $b = $ob->refcnt_cnt; |
|
|
375 | warn "rc $a,$a_ $b,$b_\n";#d# |
370 | }; |
376 | }; |
371 | warn $@ if $@; |
377 | warn $@ if $@; |
372 | Coro::cede; |
378 | Coro::cede; |
373 | }; |
379 | }; |
374 | } |
380 | } |
375 | }; |
381 | }; |
376 | |
382 | |
|
|
383 | cf::player::find "schmorp";#d# |
|
|
384 | |
377 | $SCHEDULER->prio (1); |
385 | $SCHEDULER->prio (1); |
378 | |
386 | |