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.448 by root, Fri Sep 19 05:30:23 2008 UTC vs.
Revision 1.452 by root, Tue Sep 23 00:24:52 2008 UTC

66$Storable::canonical = 1; # reduce rsync transfers 66$Storable::canonical = 1; # reduce rsync transfers
67Coro::State::cctx_stacksize 256000; # 1-2MB stack, for deep recursions in maze generator 67Coro::State::cctx_stacksize 256000; # 1-2MB stack, for deep recursions in maze generator
68 68
69$Coro::main->prio (Coro::PRIO_MAX); # run main coroutine ("the server") with very high priority 69$Coro::main->prio (Coro::PRIO_MAX); # run main coroutine ("the server") with very high priority
70 70
71{ 71# make sure c-lzf reinitialises itself
72 # very ugly, but ensure we acquire the storable lock
73
74 sub net_mstore {
75 my $guard = Coro::Storable::guard;
76 &Storable::net_mstore
77 }
78
79 sub mretrieve {
80 my $guard = Coro::Storable::guard;
81 &Storable::mretrieve
82 }
83
84 Compress::LZF::set_serializer "Coro::Storable", "cf::net_mstore", "cf::mretrieve"; 72Compress::LZF::set_serializer "Storable", "Storable::net_mstore", "Storable::mretrieve";
85 Compress::LZF::sfreeze_cr { }; # prime Compress::LZF so it does not use require later 73Compress::LZF::sfreeze_cr { }; # prime Compress::LZF so it does not use require later
86}
87 74
88sub WF_AUTOCANCEL () { 1 } # automatically cancel this watcher on reload 75sub WF_AUTOCANCEL () { 1 } # automatically cancel this watcher on reload
89 76
90our %COMMAND = (); 77our %COMMAND = ();
91our %COMMAND_TIME = (); 78our %COMMAND_TIME = ();
94our %EXTCMD = (); 81our %EXTCMD = ();
95our %EXTICMD = (); 82our %EXTICMD = ();
96our %EXT_CORO = (); # coroutines bound to extensions 83our %EXT_CORO = (); # coroutines bound to extensions
97our %EXT_MAP = (); # pluggable maps 84our %EXT_MAP = (); # pluggable maps
98 85
99our $RELOAD; # number of reloads so far 86our $RELOAD; # number of reloads so far, non-zero while in reload
100our @EVENT; 87our @EVENT;
101 88
102our $CONFDIR = confdir; 89our $CONFDIR = confdir;
103our $DATADIR = datadir; 90our $DATADIR = datadir;
104our $LIBDIR = "$DATADIR/ext"; 91our $LIBDIR = "$DATADIR/ext";
354 return;#d# 341 return;#d#
355 }#d# 342 }#d#
356 343
357 # wait for lock, if any 344 # wait for lock, if any
358 while ($LOCK{$key}) { 345 while ($LOCK{$key}) {
346 #local $Coro::current->{desc} = "$Coro::current->{desc} <waiting for lock $key>";
359 push @{ $LOCK{$key} }, $Coro::current; 347 push @{ $LOCK{$key} }, $Coro::current;
360 Coro::schedule; 348 Coro::schedule;
361 } 349 }
362} 350}
363 351
1457 1445
1458sub exists($) { 1446sub exists($) {
1459 my ($login) = @_; 1447 my ($login) = @_;
1460 1448
1461 $cf::PLAYER{$login} 1449 $cf::PLAYER{$login}
1462 or cf::sync_job { !aio_stat path $login } 1450 or !aio_stat path $login
1463} 1451}
1464 1452
1465sub find($) { 1453sub find($) {
1466 return $cf::PLAYER{$_[0]} || do { 1454 return $cf::PLAYER{$_[0]} || do {
1467 my $login = $_[0]; 1455 my $login = $_[0];
2784 id => "infobox", 2772 id => "infobox",
2785 title => "Body Parts", 2773 title => "Body Parts",
2786 reply => undef, 2774 reply => undef,
2787 tooltip => "Shows which body parts you posess and are available", 2775 tooltip => "Shows which body parts you posess and are available",
2788 }, 2776 },
2777 "c/skills" => {
2778 id => "infobox",
2779 title => "Skills",
2780 reply => undef,
2781 tooltip => "Shows your experience per skill and item power",
2782 },
2789 "c/uptime" => { 2783 "c/uptime" => {
2790 id => "infobox", 2784 id => "infobox",
2791 title => "Uptime", 2785 title => "Uptime",
2792 reply => undef, 2786 reply => undef,
2793 tooltip => "How long the server has been running since last restart", 2787 tooltip => "How long the server has been running since last restart",
3587 my $leaf_symtab = *{$stem_symtab->{$leaf}}{HASH}; 3581 my $leaf_symtab = *{$stem_symtab->{$leaf}}{HASH};
3588 for my $name (keys %$leaf_symtab) { 3582 for my $name (keys %$leaf_symtab) {
3589 _gv_clear *{"$pkg$name"}; 3583 _gv_clear *{"$pkg$name"};
3590# use PApp::Util; PApp::Util::sv_dump *{"$pkg$name"}; 3584# use PApp::Util; PApp::Util::sv_dump *{"$pkg$name"};
3591 } 3585 }
3592 warn "cleared package #$pkg\n";#d# 3586 warn "cleared package $pkg\n";#d#
3593} 3587}
3594
3595our $RELOAD; # how many times to reload
3596 3588
3597sub do_reload_perl() { 3589sub do_reload_perl() {
3598 # can/must only be called in main 3590 # can/must only be called in main
3599 if ($Coro::current != $Coro::main) { 3591 if ($Coro::current != $Coro::main) {
3600 warn "can only reload from main coroutine"; 3592 warn "can only reload from main coroutine";
3714 3706
3715sub reload_perl() { 3707sub reload_perl() {
3716 # doing reload synchronously and two reloads happen back-to-back, 3708 # doing reload synchronously and two reloads happen back-to-back,
3717 # coro crashes during coro_state_free->destroy here. 3709 # coro crashes during coro_state_free->destroy here.
3718 3710
3719 $RELOAD_WATCHER ||= EV::timer 0, 0, sub { 3711 $RELOAD_WATCHER ||= EV::timer $TICK * 1.5, 0, sub {
3720 do_reload_perl; 3712 do_reload_perl;
3721 undef $RELOAD_WATCHER; 3713 undef $RELOAD_WATCHER;
3722 }; 3714 };
3723} 3715}
3724 3716

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines