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.71 by root, Sun Sep 2 12:45:44 2007 UTC vs.
Revision 1.75 by root, Wed Dec 26 21:38:02 2007 UTC

175 } 175 }
176 176
177 $ns->pl and return $ns->destroy; 177 $ns->pl and return $ns->destroy;
178 178
179 $ns->async (sub { 179 $ns->async (sub {
180 $Coro::current->{desc} = "addme init";
181
180 my ($user, $pass); 182 my ($user, $pass);
181 183
182 $ns->send_packet ("addme_success"); 184 $ns->send_packet ("addme_success");
183 185
184 for (;;) { 186 for (;;) {
211 } 213 }
212 Coro::Timer::sleep 0.4; 214 Coro::Timer::sleep 0.4;
213 } 215 }
214 216
215 check_playing $ns, $user and next; 217 check_playing $ns, $user and next;
218
219 $Coro::current->{desc} = "addme($user) pass";
216 220
217 $ns->send_drawinfo ( 221 $ns->send_drawinfo (
218 "Welcome $user, please enter your password now. " 222 "Welcome $user, please enter your password now. "
219 . "New users should now choose a password. " 223 . "New users should now choose a password. "
220 . "Anything your client lets you enter is fine.", 224 . "Anything your client lets you enter is fine.",
244 } 248 }
245 local $cf::LOGIN_LOCK{$user} = 1; 249 local $cf::LOGIN_LOCK{$user} = 1;
246 250
247 check_playing $ns, $user and next; 251 check_playing $ns, $user and next;
248 252
253 $Coro::current->{desc} = "addme($user) check";
254
249 # try to read the user file and check the password 255 # try to read the user file and check the password
250 if (my $pl = cf::player::find $user) { 256 if (my $pl = cf::player::find $user) {
251 aio_stat $pl->path and next; 257 aio_stat $pl->path and next;
252 my $mtime = (stat _)[9]; 258 my $mtime = (stat _)[9];
253 my $hash = $pl->password; 259 my $hash = $pl->password;
306 next; 312 next;
307 } 313 }
308 } 314 }
309 315
310 # the rest of this function is character creation 316 # the rest of this function is character creation
317 $Coro::current->{desc} = "addme($user) chargen";
311 318
312 # just to make sure nothing is left over 319 # just to make sure nothing is left over
313 nuke_playerdir $user; 320 nuke_playerdir $user;
314 321
315 my $pass2 = query $ns, cf::CS_QUERY_HIDEINPUT, "Please type your password again."; 322 my $pass2 = query $ns, cf::CS_QUERY_HIDEINPUT, "Please type your password again.";
389 last; 396 last;
390 } 397 }
391 Coro::Timer::sleep 0.2; 398 Coro::Timer::sleep 0.2;
392 } 399 }
393 400
394 $ob->reply (undef, "Welcome to Crossfire!"); 401 $ob->reply (undef, "Welcome to Deliantra!");
395 402
396 delete $pl->{deny_save}; 403 delete $pl->{deny_save};
397 404
398 last; 405 last;
399 } 406 }
483 490
484our $SCHEDULE_INTERVAL = $cf::CFG{player_schedule_interval} || 10; # time the player scheduler sleeps between runs 491our $SCHEDULE_INTERVAL = $cf::CFG{player_schedule_interval} || 10; # time the player scheduler sleeps between runs
485our $SAVE_TIMEOUT = $cf::CFG{player_save_interval} || 20; # save players every n seconds 492our $SAVE_TIMEOUT = $cf::CFG{player_save_interval} || 20; # save players every n seconds
486 493
487our $SCHEDULER = cf::async_ext { 494our $SCHEDULER = cf::async_ext {
488 my $schedule_interval = Coro::Event->timer (after => 1); 495 $Coro::current->{desc} = "player scheduler";
496
489 while () { 497 while () {
490 $schedule_interval->interval ($SCHEDULE_INTERVAL); 498 Coro::EV::timer_once $SCHEDULE_INTERVAL;
491 $schedule_interval->next;
492 499
493 # this weird form of iteration over values is used because 500 # this weird form of iteration over values is used because
494 # the hash changes underneath us frequently, and for 501 # the hash changes underneath us frequently, and for
495 # keeps a direct reference to the value without (in 5.8 perls) 502 # keeps a direct reference to the value without (in 5.8 perls)
496 # keeping a reference, so this is prone to crashes or worse. 503 # keeping a reference, so this is prone to crashes or worse.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines