ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/DB.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/DB.pm (file contents):
Revision 1.1 by root, Fri Apr 6 07:45:34 2007 UTC vs.
Revision 1.4 by root, Fri Apr 6 23:00:52 2007 UTC

18use utf8; 18use utf8;
19 19
20use Carp (); 20use Carp ();
21use AnyEvent (); 21use AnyEvent ();
22use Storable (); # finally 22use Storable (); # finally
23
24use CFPlus;
23 25
24sub sync { 26sub sync {
25 # for debugging 27 # for debugging
26 #CFPlus::DB::Server::req (sync => sub { }); 28 #CFPlus::DB::Server::req (sync => sub { });
27 CFPlus::DB::Server::sync (); 29 CFPlus::DB::Server::sync ();
100 -Flags => DB_CREATE | DB_UPGRADE, 102 -Flags => DB_CREATE | DB_UPGRADE,
101 or die "unable to create/open database table $_[0]: $BerkeleyDB::Error" 103 or die "unable to create/open database table $_[0]: $BerkeleyDB::Error"
102 } 104 }
103} 105}
104 106
105our $SYNC_INTERVAL = 6; 107our $SYNC_INTERVAL = 60;
106 108
107our %CB; 109our %CB;
108our $FH; 110our $FH;
109our $ID = "aaa0"; 111our $ID = "aaa0";
110our ($fh_r_watcher, $fh_w_watcher); 112our ($fh_r_watcher, $fh_w_watcher);
278 280
279 CFPlus::_exit 0; 281 CFPlus::_exit 0;
280 } 282 }
281 283
282 close $fh; 284 close $fh;
283 fcntl $FH, F_SETFL, O_NONBLOCK; 285 CFPlus::fh_nonblocking $FH, 1;
284 286
285 $CB{die} = sub { 287 $CB{die} = sub { die shift };
286 die shift;
287 };
288 288
289 $fh_r_watcher = AnyEvent->io (fh => $FH, poll => 'r', cb => \&fh_read); 289 $fh_r_watcher = AnyEvent->io (fh => $FH, poll => 'r', cb => \&fh_read);
290 290
291 sync_tick; 291 sync_tick;
292} 292}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines