… | |
… | |
444 | warn $@ if $@; |
444 | warn $@ if $@; |
445 | undef $busy; |
445 | undef $busy; |
446 | })->prio (Coro::PRIO_MAX); |
446 | })->prio (Coro::PRIO_MAX); |
447 | |
447 | |
448 | while ($busy) { |
448 | while ($busy) { |
|
|
449 | if (Coro::nready) { |
|
|
450 | Coro::cede_notself; |
|
|
451 | } else { |
449 | Coro::cede or Event::one_event; |
452 | Event::one_event; |
|
|
453 | } |
450 | } |
454 | } |
451 | |
455 | |
452 | $time = Event::time - $time; |
456 | $time = Event::time - $time; |
453 | |
457 | |
454 | LOG llevError | logBacktrace, Carp::longmess "long sync job" |
458 | LOG llevError | logBacktrace, Carp::longmess "long sync job" |
… | |
… | |
1077 | close $fh; |
1081 | close $fh; |
1078 | |
1082 | |
1079 | if (@$objs) { |
1083 | if (@$objs) { |
1080 | if (my $fh = aio_open "$filename.pst~", O_WRONLY | O_CREAT, 0600) { |
1084 | if (my $fh = aio_open "$filename.pst~", O_WRONLY | O_CREAT, 0600) { |
1081 | chmod SAVE_MODE, $fh; |
1085 | chmod SAVE_MODE, $fh; |
1082 | my $data = Coro::Storable::blocking_nfreeze { version => 1, objs => $objs }; |
1086 | my $data = Coro::Storable::nfreeze { version => 1, objs => $objs }; |
1083 | aio_write $fh, 0, (length $data), $data, 0; |
1087 | aio_write $fh, 0, (length $data), $data, 0; |
1084 | aio_fsync $fh if $cf::USE_FSYNC; |
1088 | aio_fsync $fh if $cf::USE_FSYNC; |
1085 | close $fh; |
1089 | close $fh; |
1086 | aio_rename "$filename.pst~", "$filename.pst"; |
1090 | aio_rename "$filename.pst~", "$filename.pst"; |
1087 | } |
1091 | } |
… | |
… | |
1118 | |
1122 | |
1119 | unless (aio_stat "$filename.pst") { |
1123 | unless (aio_stat "$filename.pst") { |
1120 | (aio_load "$filename.pst", $av) >= 0 |
1124 | (aio_load "$filename.pst", $av) >= 0 |
1121 | or return; |
1125 | or return; |
1122 | |
1126 | |
1123 | my $st = eval { Coro::Storable::thaw $av } |
1127 | my $st = eval { Coro::Storable::thaw $av }; |
1124 | || eval { my $guard = Coro::Storable::guard; Storable::thaw $av }; #d# compatibility, remove |
|
|
1125 | $av = $st->{objs}; |
1128 | $av = $st->{objs}; |
1126 | } |
1129 | } |
1127 | |
1130 | |
1128 | utf8::decode (my $decname = $filename); |
1131 | utf8::decode (my $decname = $filename); |
1129 | warn sprintf "loading %s (%d,%d)\n", |
1132 | warn sprintf "loading %s (%d,%d)\n", |
… | |
… | |
2676 | id => "infobox", |
2679 | id => "infobox", |
2677 | title => "Examine", |
2680 | title => "Examine", |
2678 | reply => undef, |
2681 | reply => undef, |
2679 | tooltip => "Signs and other items you examined", |
2682 | tooltip => "Signs and other items you examined", |
2680 | }, |
2683 | }, |
|
|
2684 | "c/book" => { |
|
|
2685 | id => "infobox", |
|
|
2686 | title => "Book", |
|
|
2687 | reply => undef, |
|
|
2688 | tooltip => "The contents of a note or book", |
|
|
2689 | }, |
2681 | "c/lookat" => { |
2690 | "c/lookat" => { |
2682 | id => "infobox", |
2691 | id => "infobox", |
2683 | title => "Look", |
2692 | title => "Look", |
2684 | reply => undef, |
2693 | reply => undef, |
2685 | tooltip => "What you saw there", |
2694 | tooltip => "What you saw there", |
|
|
2695 | }, |
|
|
2696 | "c/who" => { |
|
|
2697 | id => "infobox", |
|
|
2698 | title => "Players", |
|
|
2699 | reply => undef, |
|
|
2700 | tooltip => "Shows players who are currently online", |
|
|
2701 | }, |
|
|
2702 | "c/body" => { |
|
|
2703 | id => "infobox", |
|
|
2704 | title => "Body Parts", |
|
|
2705 | reply => undef, |
|
|
2706 | tooltip => "Shows which body parts you posess and are available", |
|
|
2707 | }, |
|
|
2708 | "c/uptime" => { |
|
|
2709 | id => "infobox", |
|
|
2710 | title => "Uptime", |
|
|
2711 | reply => undef, |
|
|
2712 | tooltip => "How long the server has been running sicne last restart", |
|
|
2713 | }, |
|
|
2714 | "c/mapinfo" => { |
|
|
2715 | id => "infobox", |
|
|
2716 | title => "Map Info", |
|
|
2717 | reply => undef, |
|
|
2718 | tooltip => "Information related to the maps", |
2686 | }, |
2719 | }, |
2687 | ); |
2720 | ); |
2688 | |
2721 | |
2689 | sub cf::client::send_msg { |
2722 | sub cf::client::send_msg { |
2690 | my ($self, $channel, $msg, $color, @extra) = @_; |
2723 | my ($self, $channel, $msg, $color, @extra) = @_; |
… | |
… | |
3369 | |
3402 | |
3370 | warn "flushing outstanding aio requests"; |
3403 | warn "flushing outstanding aio requests"; |
3371 | for (;;) { |
3404 | for (;;) { |
3372 | BDB::flush; |
3405 | BDB::flush; |
3373 | IO::AIO::flush; |
3406 | IO::AIO::flush; |
3374 | Coro::cede; |
3407 | Coro::cede_notself; |
3375 | last unless IO::AIO::nreqs || BDB::nreqs; |
3408 | last unless IO::AIO::nreqs || BDB::nreqs; |
3376 | warn "iterate..."; |
3409 | warn "iterate..."; |
3377 | } |
3410 | } |
3378 | |
3411 | |
3379 | ++$RELOAD; |
3412 | ++$RELOAD; |