… | |
… | |
395 | my $runtime = "$LOCALDIR/runtime"; |
395 | my $runtime = "$LOCALDIR/runtime"; |
396 | |
396 | |
397 | # first touch the runtime file to show we are still running: |
397 | # first touch the runtime file to show we are still running: |
398 | # the fsync below can take a very very long time. |
398 | # the fsync below can take a very very long time. |
399 | |
399 | |
400 | if (my $fh = aio_open $runtime, O_WRONLY, 0) { |
400 | IO::AIO::aio_utime $runtime, undef, undef; |
401 | utime undef, undef, $fh; |
|
|
402 | } |
|
|
403 | |
401 | |
404 | my $guard = cf::lock_acquire "write_runtime"; |
402 | my $guard = cf::lock_acquire "write_runtime"; |
405 | |
403 | |
406 | my $fh = aio_open "$runtime~", O_WRONLY | O_CREAT, 0644 |
404 | my $fh = aio_open "$runtime~", O_WRONLY | O_CREAT, 0644 |
407 | or return; |
405 | or return; |
… | |
… | |
416 | # always fsync - this file is important |
414 | # always fsync - this file is important |
417 | aio_fsync $fh |
415 | aio_fsync $fh |
418 | and return; |
416 | and return; |
419 | |
417 | |
420 | # touch it again to show we are up-to-date |
418 | # touch it again to show we are up-to-date |
421 | utime undef, undef, $fh; |
419 | aio_utime $fh, undef, undef; |
422 | |
420 | |
423 | close $fh |
421 | close $fh |
424 | or return; |
422 | or return; |
425 | |
423 | |
426 | aio_rename "$runtime~", $runtime |
424 | aio_rename "$runtime~", $runtime |
… | |
… | |
2481 | warn $@ if $@; |
2479 | warn $@ if $@; |
2482 | _exit 0; |
2480 | _exit 0; |
2483 | } |
2481 | } |
2484 | } |
2482 | } |
2485 | |
2483 | |
2486 | |
|
|
2487 | |
|
|
2488 | ############################################################################# |
2484 | ############################################################################# |
2489 | # the server's init and main functions |
2485 | # the server's init and main functions |
2490 | |
2486 | |
2491 | sub load_facedata($) { |
2487 | sub load_facedata($) { |
2492 | my ($path) = @_; |
2488 | my ($path) = @_; |
… | |
… | |
2505 | { |
2501 | { |
2506 | my $faces = $facedata->{faceinfo}; |
2502 | my $faces = $facedata->{faceinfo}; |
2507 | |
2503 | |
2508 | while (my ($face, $info) = each %$faces) { |
2504 | while (my ($face, $info) = each %$faces) { |
2509 | my $idx = (cf::face::find $face) || cf::face::alloc $face; |
2505 | my $idx = (cf::face::find $face) || cf::face::alloc $face; |
|
|
2506 | warn "$face $info->{magicmap}\n" if $face =~ /obol/;#d# |
2510 | cf::face::set $idx, $info->{visibility}, $info->{magicmap}; |
2507 | cf::face::set $idx, $info->{visibility}, $info->{magicmap}; |
2511 | cf::face::set_data $idx, 0, $info->{data32}, $info->{chksum32}; |
2508 | cf::face::set_data $idx, 0, $info->{data32}, $info->{chksum32}; |
2512 | cf::face::set_data $idx, 1, $info->{data64}, $info->{chksum64}; |
2509 | cf::face::set_data $idx, 1, $info->{data64}, $info->{chksum64}; |
2513 | Coro::cede; |
2510 | Coro::cede; |
2514 | } |
2511 | } |