… | |
… | |
72 | |
72 | |
73 | # make sure c-lzf reinitialises itself |
73 | # make sure c-lzf reinitialises itself |
74 | Compress::LZF::set_serializer "Storable", "Storable::net_mstore", "Storable::mretrieve"; |
74 | Compress::LZF::set_serializer "Storable", "Storable::net_mstore", "Storable::mretrieve"; |
75 | Compress::LZF::sfreeze_cr { }; # prime Compress::LZF so it does not use require later |
75 | Compress::LZF::sfreeze_cr { }; # prime Compress::LZF so it does not use require later |
76 | |
76 | |
|
|
77 | # strictly for debugging |
|
|
78 | $SIG{QUIT} = sub { Carp::cluck "SIGQUIT" }; |
|
|
79 | |
77 | sub WF_AUTOCANCEL () { 1 } # automatically cancel this watcher on reload |
80 | sub WF_AUTOCANCEL () { 1 } # automatically cancel this watcher on reload |
78 | |
81 | |
79 | our %COMMAND = (); |
82 | our %COMMAND = (); |
80 | our %COMMAND_TIME = (); |
83 | our %COMMAND_TIME = (); |
81 | |
84 | |
… | |
… | |
134 | our $JITTER; # average jitter |
137 | our $JITTER; # average jitter |
135 | our $TICK_START; # for load detecting purposes |
138 | our $TICK_START; # for load detecting purposes |
136 | |
139 | |
137 | our @POST_INIT; |
140 | our @POST_INIT; |
138 | |
141 | |
139 | our $REATTACH_ON_RELOAD; # ste to true to force object reattach on reload (slow) |
142 | our $REATTACH_ON_RELOAD; # set to true to force object reattach on reload (slow) |
|
|
143 | our $REALLY_UNLOOP; # never set to true, please :) |
140 | |
144 | |
141 | binmode STDOUT; |
145 | binmode STDOUT; |
142 | binmode STDERR; |
146 | binmode STDERR; |
143 | |
147 | |
144 | # read virtual server time, if available |
148 | # read virtual server time, if available |
… | |
… | |
3400 | |
3404 | |
3401 | seek $fh, 0, 0; |
3405 | seek $fh, 0, 0; |
3402 | print $fh $$; |
3406 | print $fh $$; |
3403 | } |
3407 | } |
3404 | |
3408 | |
|
|
3409 | sub main_loop { |
|
|
3410 | warn "EV::loop starting\n"; |
|
|
3411 | if (1) { |
|
|
3412 | EV::loop; |
|
|
3413 | } |
|
|
3414 | warn "EV::loop returned\n"; |
|
|
3415 | goto &main_loop unless $REALLY_UNLOOP; |
|
|
3416 | } |
|
|
3417 | |
3405 | sub main { |
3418 | sub main { |
3406 | cf::init_globals; # initialise logging |
3419 | cf::init_globals; # initialise logging |
3407 | |
3420 | |
3408 | LOG llevInfo, "Welcome to Deliantra, v" . VERSION; |
3421 | LOG llevInfo, "Welcome to Deliantra, v" . VERSION; |
3409 | LOG llevInfo, "Copyright (C) 2005-2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team."; |
3422 | LOG llevInfo, "Copyright (C) 2005-2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team."; |
… | |
… | |
3452 | POSIX::close delete $ENV{LOCKUTIL_LOCK_FD} if exists $ENV{LOCKUTIL_LOCK_FD}; |
3465 | POSIX::close delete $ENV{LOCKUTIL_LOCK_FD} if exists $ENV{LOCKUTIL_LOCK_FD}; |
3453 | |
3466 | |
3454 | (pop @POST_INIT)->(0) while @POST_INIT; |
3467 | (pop @POST_INIT)->(0) while @POST_INIT; |
3455 | }; |
3468 | }; |
3456 | |
3469 | |
3457 | EV::loop; |
3470 | main_loop; |
3458 | } |
3471 | } |
3459 | |
3472 | |
3460 | ############################################################################# |
3473 | ############################################################################# |
3461 | # initialisation and cleanup |
3474 | # initialisation and cleanup |
3462 | |
3475 | |