Jump to content

Why ServerLimits= srOneperIP don't work on mobile device ?


irigsoft

Recommended Posts

Hello,

I use unigui Professional and configure:

1. servermodule.serverlimits.SessionRestrict = srOnePerIP ;. I set this in UniGUIServerModuleBeforeInit

2. uniMainModule.TerminateOnBrowserClose = True;

3. In MainForm I have uniTimer.Enable: = True, ChainMode: = True;


When I use a desktop browser (Chrome) and close the browser tab, the session is closed - OK, but my problem is:

problems with TerminateonBrowserClose;

1. when using the mobile browser chrome and closing the tab the session is not stopped (no matter how long I wait)

2. when you use mobile web view (with android app) and close the app, the session does not stop

problems with server limitations

1. when I open a session through a mobile browser, close it and open it again (without changing the IP) - the previous session does not stop

2. when I open a session via web view (android application), close the application and open it again (without changing the IP) - the previous session is not stopped

 

Is this a bug in the version (1526 - 1537) or did I not set something up correctly?

This is important to me because I release a lot of components when closing a session, and if the session doesn't close my standalone application crashes after a few days

 

On user login I have procedure that execute this, but is not work too :

var
I : Integer;
U : TUniGUISession;
begin
Try
  UniServerModule.SessionManager.Sessions.Lock;
  for I :=UniServerModule.SessionManager.Sessions.SessionList.Count - 1 downto 0 do begin
      TRy
      U := UniServerModule.SessionManager.Sessions.SessionList[I];
      // Check mainModule availability. Some sessions may not have a MainModule instance
      if U.UniMainModule <> nil then begin
        // Do not close my OWN Session
        if (UniApplication.UniSession.SessionID <> U.SessionId)
        AND ((U.UniMainModule as TUniMainModule).sUserName = sesionUser)
        then begin
           TRY
              //U.LockSession;
              //U.ReleaseSession;

              U.Terminate (uniServerModule.urlMessage);
           FINALLY
              //U.UnBusy;
           END;

        end;
        //close all session with this  IP
        if ServerLimits.SessionRestrict = srOnePerIP then begin
          if (UniApplication.UniSession.SessionID <> U.SessionId)
          AND ((U.UniMainModule as TUniMainModule).RemoteAddress = uniMainModule.sessionIP)
          then begin
             TRY
                //U.LockSession;
                //U.ReleaseSession;
                U.Terminate (uniServerModule.urlMessage);
             FINALLY
                //U.UnBusy;
             END;
          end;
        end;//srOnePerIP

      end;//If U
      Except
            on E:Exception do begin
                  UniServerModule.SaveHTMLLog ('Close session ERR: ' + e.message);
            end;
      End;
  end;//for I
Finally
  UniServerModule.SessionManager.Sessions.Unlock;
End;

Link to comment
Share on other sites

Something strange.

If I use two phones with Android 10 then all problems exist.

when I use my Tablet with Android 5, and other tablet with Android 6, in local network (or internet) then all is OK.

when I use Tablet with Android 9 then TerminateOnBrowserClose is not OK, but ServerLimits = srOnePerIP is OK

Link to comment
Share on other sites

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...