change timestamp in PC9x to seconds in day.
sub LogDbg
{
- DXDebug::dbg($_[$#_]);
+ DXDebug::dbg($_) for @_;
Log(@_);
}
if (!$_last_time || $_last_time != $main::systime) {
$_last_time = $main::systime;
$_last_occurs = 0;
- return $_last_time;
+ return $_last_time - $main::systime_daystart;
} else {
$_last_occurs++;
return sprintf "$_last_time.%02d", $_last_occurs;
my $parent = ref $call ? $call : Route::Node::get($call);
if ($parent) {
my $lastid = $parent->lastid->{$pc} || 0;
+ $t += 86400 if $t < $lastid - 43200;
if ($lastid >= $t) {
dbg("PCPROT: dup / old id on $call <= $lastid, ignored") if isdbg('chanerr');
return;
}
+ $t -= 86400 if $t >= 86400;
} elsif ($create) {
$parent = Route::Node->new($call);
}
}
my $parent = check_pc9x_t($pcall, $t, 92, 1);
+ return unless $parent;
$parent->lastid->{92} = $t;
$parent->do_pc92(1);
# and update any information that needs to be done.
my ($call, $is_node, $is_extnode, $here, $version, $build) = _decode_pc92_call($ent[0]);
if ($call && $is_node) {
+ if ($call eq $main::mycall) {
+ dbg("PCPROT: looped back on node entry, ignored") if isdbg('chanerr');
+ return;
+ }
if ($is_extnode) {
# reparent to external node (note that we must have received a 'C' or 'A' record
# from the true parent node for this external before we get one for the this node
require POSIX; POSIX->import(qw(O_NONBLOCK F_SETFL F_GETFL))
};
if ($@ || $main::is_win) {
-# print STDERR "POSIX Blocking *** NOT *** supported $@\n";
- $blocking_supported = 0;
+ $blocking_supported = IO::Socket->can('blocking') ? 2 : 0;
} else {
- $blocking_supported = 1;
-# print STDERR "POSIX Blocking enabled\n";
+ $blocking_supported = IO::Socket->can('blocking') ? 2 : 1;
}
return unless $blocking_supported;
# Make the handle stop blocking, the Windows way.
- if ($main::is_win) {
- # 126 is FIONBIO (some docs say 0x7F << 16)
- ioctl( $_[0],
- 0x80000000 | (4 << 16) | (ord('f') << 8) | 126,
- "$_[1]"
- );
+ if ($blocking_supported) {
+ $_[0]->blocking($_[1]);
} else {
my $flags = fcntl ($_[0], F_GETFL, 0);
if ($_[1]) {
# return to the event loop only after every message, or if it
# is likely to block in the middle of a message.
- if ($conn->{blocking} != $flush) {
- blocking($sock, $flush);
- $conn->{blocking} = $flush;
- }
+# if ($conn->{blocking} != $flush) {
+# blocking($sock, $flush);
+# $conn->{blocking} = $flush;
+# }
my $offset = (exists $conn->{send_offset}) ? $conn->{send_offset} : 0;
while (@$rq) {
use vars qw(@inqueue $systime $version $starttime $lockfn @outstanding_connects
$zombies $root @listeners $lang $myalias @debug $userfn $clusteraddr
$clusterport $mycall $decease $is_win $routeroot $me $reqreg $bumpexisting
- $allowdxby $dbh $dsn $dbuser $dbpass $do_xml
+ $allowdxby $dbh $dsn $dbuser $dbpass $do_xml $systime_days $systime_daystart
);
@inqueue = (); # the main input queue, an array of hashes
#############################################################
$starttime = $systime = time;
+$systime_days = int ($systime / 86400);
+$systime_daystart = $systime_days * 86400;
$lang = 'en' unless $lang;
unless ($DB::VERSION) {
# do timed stuff, ongoing processing happens one a second
if ($timenow != $systime) {
reap() if $zombies;
- IsoTime::update($systime = $timenow);
+ $systime = $timenow;
+ my $days = int ($systime / 86400);
+ if ($systime_days != $days) {
+ $systime_days = $days;
+ $systime_daystart = $days * 86400;
+ }
+ IsoTime::update($systime);
DXCron::process(); # do cron jobs
DXCommandmode::process(); # process ongoing command mode stuff
DXXml::process();