#1 2020-12-30 18:54:17

PBa
Member
From: Austria
Registered: 2017-01-04
Posts: 18

mORMot2: bug in TRestServer.SessionDeleteDeprecated?

@ab:
SessionDeleteDeprecated returns the system tix count number in second resolution.
But why is this result increased every time when a deprecated session is found and deleted within the loop below?
IMHO „inc(result)“ should be deleted as this line will change the deletion condition for each next session item in fSessions.List.
Or am I missing something?

Thanks a lot!
Paul

function TRestServer.SessionDeleteDeprecated: cardinal;
...
begin // caller made fSessions.Safe.Lock
  result := GetTickCount64 shr 10;
  if (self <> nil) and
    ...
    fSessionsDeprecatedTix := result;
    for i := fSessions.Count - 1 downto 0 do
      if result > TAuthSession(fSessions.List[i]).TimeOutTix then
      begin
        SessionDelete(i, nil);
        inc(result); // <== why increasing result within this loop?
      end;
  end;
end;

Offline

#2 2020-12-31 09:24:50

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,660
Website

Re: mORMot2: bug in TRestServer.SessionDeleteDeprecated?

This is indeed a bug.

The initial design returned the number of deleted session.
But it is not a big issue, since it would just add a few seconds to the new session timeout.

See https://synopse.info/fossil/info/72d60cc313

Thanks for the feedback!
smile

Offline

Board footer

Powered by FluxBB