Jump to content

Recommended Posts

Posted

I have a problem with my HyperServer, It's not closing all sessions, when these are finished.

So I'm trying to figure it out differently ...
With a UniThreadTimer in the Servermodule with an interval of 1 minute. I have a code like the following:

procedure TUniServerModule.UniThreadTimer1Timer(Sender: TObject);
var
  i:Integer;
  Sesion:TUniGUISession;
begin
  UniServerModule.SessionManager.Sessions.Lock;
  try
    for i:=UniServerModule.SessionManager.Sessions.SessionList.Count-1 downto 0 do
    begin
      Sesion:=UniServerModule.SessionManager.Sessions.SessionList[i];
      if (MinutesBetween(Now,Sesion.LastTimeStamp)>(SessionTimeout div 1000 div 60)+5) then
      begin
        sesion.ReleaseSession;
        Sesion.Terminate('Ha superado el tiempo de inactividad. Se cerró la sesión');
      end;
    end;
  finally
    UniServerModule.SessionManager.Sessions.UnLock;
  end;
end;

it goes through all the sessions and the one that since its LastTimeStamp has passed (SessionTimeOut div 1000 div 60) +5 (5 tolerance) minutes. I'm trying to log out.
With this solution, there are still open sessions. Could anybody suggest a solution. ?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...