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.379 by root, Thu Oct 4 23:59:07 2007 UTC vs.
Revision 1.380 by root, Mon Oct 8 13:58:07 2007 UTC

10use Event; 10use Event;
11use Opcode; 11use Opcode;
12use Safe; 12use Safe;
13use Safe::Hole; 13use Safe::Hole;
14 14
15use Coro 3.64 (); 15use Coro 4.1 ();
16use Coro::State; 16use Coro::State;
17use Coro::Handle; 17use Coro::Handle;
18use Coro::Event; 18use Coro::Event;
19use Coro::Timer; 19use Coro::Timer;
20use Coro::Signal; 20use Coro::Signal;
27use BDB (); 27use BDB ();
28use Data::Dumper; 28use Data::Dumper;
29use Digest::MD5; 29use Digest::MD5;
30use Fcntl; 30use Fcntl;
31use YAML::Syck (); 31use YAML::Syck ();
32use IO::AIO 2.32 (); 32use IO::AIO 2.51 ();
33use Time::HiRes; 33use Time::HiRes;
34use Compress::LZF; 34use Compress::LZF;
35use Digest::MD5 (); 35use Digest::MD5 ();
36 36
37# configure various modules to our taste 37# configure various modules to our taste
373 } 373 }
374 } 374 }
375 } 375 }
376 376
377 if (@SLOT_QUEUE) { 377 if (@SLOT_QUEUE) {
378 # we do not use wait_For_tick() as it returns immediately when tick is inactive 378 # we do not use wait_for_tick() as it returns immediately when tick is inactive
379 push @cf::WAIT_FOR_TICK, $signal; 379 push @cf::WAIT_FOR_TICK, $signal;
380 $signal->wait; 380 $signal->wait;
381 } else { 381 } else {
382 Coro::schedule; 382 Coro::schedule;
383 } 383 }
1046 close $fh; 1046 close $fh;
1047 1047
1048 if (@$objs) { 1048 if (@$objs) {
1049 if (my $fh = aio_open "$filename.pst~", O_WRONLY | O_CREAT, 0600) { 1049 if (my $fh = aio_open "$filename.pst~", O_WRONLY | O_CREAT, 0600) {
1050 chmod SAVE_MODE, $fh; 1050 chmod SAVE_MODE, $fh;
1051 my $data = Storable::nfreeze { version => 1, objs => $objs }; 1051 my $data = Coro::Storable::nfreeze { version => 1, objs => $objs };
1052 aio_write $fh, 0, (length $data), $data, 0; 1052 aio_write $fh, 0, (length $data), $data, 0;
1053 aio_fsync $fh if $cf::USE_FSYNC; 1053 aio_fsync $fh if $cf::USE_FSYNC;
1054 close $fh; 1054 close $fh;
1055 aio_rename "$filename.pst~", "$filename.pst"; 1055 aio_rename "$filename.pst~", "$filename.pst";
1056 } 1056 }
1087 1087
1088 unless (aio_stat "$filename.pst") { 1088 unless (aio_stat "$filename.pst") {
1089 (aio_load "$filename.pst", $av) >= 0 1089 (aio_load "$filename.pst", $av) >= 0
1090 or return; 1090 or return;
1091 1091
1092 $av = eval { (Storable::thaw $av)->{objs} }; 1092 my $st = eval { Coro::Storable::thaw $av }
1093 || eval { my $guard = Coro::Storable::guard; Storable::thaw $av }; #d# compatibility, remove
1094 $av = $st->{objs};
1093 } 1095 }
1094 1096
1095 utf8::decode (my $decname = $filename); 1097 utf8::decode (my $decname = $filename);
1096 warn sprintf "loading %s (%d,%d)\n", 1098 warn sprintf "loading %s (%d,%d)\n",
1097 $decname, length $data, scalar @{$av || []}; 1099 $decname, length $data, scalar @{$av || []};

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines