Fixing clients management.
authorStephaneLenclud
Sun, 21 Jun 2015 10:18:12 +0200
changeset 14245afadb954ba
parent 141 6f1da2b5c2ec
child 143 9e1ce603fe71
Fixing clients management.
Server/MainForm.cs
     1.1 --- a/Server/MainForm.cs	Fri Jun 19 17:12:06 2015 +0200
     1.2 +++ b/Server/MainForm.cs	Sun Jun 21 10:18:12 2015 +0200
     1.3 @@ -566,12 +566,18 @@
     1.4  
     1.5  
     1.6              //Check when was the last time we switched to that client
     1.7 -            double lastSwitchToClientSecondsAgo = (DateTime.Now - iClients[aSessionId].LastSwitchTime).TotalSeconds;
     1.8 -            //TODO: put that hard coded delay in settings
     1.9 -            if (!aForce && (lastSwitchToClientSecondsAgo < 10))
    1.10 +            if (iCurrentClientData != null)
    1.11              {
    1.12 -                //Don't switch clients too often
    1.13 -                return;
    1.14 +                double lastSwitchToClientSecondsAgo = (DateTime.Now - iCurrentClientData.LastSwitchTime).TotalSeconds;
    1.15 +                //TODO: put that hard coded value as a client property
    1.16 +                //Clients should be able to define how often they can be interrupted
    1.17 +                //Thus a background client can set this to zero allowing any other client to interrupt at any time
    1.18 +                //We could also compute this delay by looking at the requests frequencies?
    1.19 +                if (!aForce && (lastSwitchToClientSecondsAgo < 30)) //Make sure a client is on for at least 30 seconds
    1.20 +                {
    1.21 +                    //Don't switch clients too often
    1.22 +                    return;
    1.23 +                }
    1.24              }
    1.25  
    1.26              //Set current client ID.