X-Git-Url: http://www.dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXUser.pm;h=454432d190ca368523e4f8b37ae69790c1220a18;hb=86d0e8cc034db0b0d23afc09b6f596c38a57885d;hp=02ed86cd002949b5d94c8f74def12ccd1e8d3db9;hpb=6ddc03379ca50a7ecbc04aea34edc8edc1ce0f84;p=spider.git diff --git a/perl/DXUser.pm b/perl/DXUser.pm index 02ed86cd..454432d1 100644 --- a/perl/DXUser.pm +++ b/perl/DXUser.pm @@ -30,7 +30,7 @@ $dbm = undef; $filename = undef; $lastoperinterval = 60*24*60*60; $lasttime = 0; -$lrusize = 3000; +$lrusize = 10000; $tooold = 86400 * 365; # this marks an old user who hasn't given enough info to be useful $v3 = 0; our $maxconnlist = 3; # remember this many connection time (duration) [start, end] pairs @@ -49,6 +49,7 @@ my $json; email => '0,E-mail Address,parray', priv => '9,Privilege Level', lastin => '0,Last Time in,cldatetime', + lastseen => '0,Last Seen,cldatetime', passwd => '9,Password,yesno', passphrase => '9,Pass Phrase,yesno', addr => '0,Full Address', @@ -179,6 +180,7 @@ sub process sub finish { + $dbm->sync; undef $dbm; untie %u; } @@ -204,6 +206,7 @@ sub new # confess "can't create existing call $call in User\n!" if $u{$call}; my $self = $pkg->alloc($call); + $self->{lastseen} = $main::systime; $self->put; return $self; } @@ -220,7 +223,10 @@ sub get # is it in the LRU cache? my $ref = $lru->get($call); - return $ref if $ref && ref $ref eq 'DXUser'; + if ($ref && ref $ref eq 'DXUser') { + $ref->{lastseen} = $main::systime; + return $ref; + } # search for it unless ($dbm->get($call, $data)) { @@ -240,6 +246,7 @@ sub get } return undef; } + $ref->{lastseen} = $main::systime; $lru->put($call, $ref); return $ref; } @@ -343,7 +350,7 @@ sub close my $self = shift; my $startt = shift; my $ip = shift; - $self->{lastin} = $main::systime; + $self->{lastseen} = $self->{lastin} = $main::systime; # add a record to the connect list my $ref = [$startt || $self->{startt}, $main::systime]; push @$ref, $ip if $ip;