Skip to content
This repository has been archived by the owner on Jul 9, 2023. It is now read-only.

Limit Sessions Per Client #924

Open
korolossamy opened this issue Jul 20, 2022 · 0 comments
Open

Limit Sessions Per Client #924

korolossamy opened this issue Jul 20, 2022 · 0 comments

Comments

@korolossamy
Copy link

korolossamy commented Jul 20, 2022

Hi Team,

I would Like to Limit 100 Sessions or Threads per Each Client connect to Proxy server
What i have tried on below but still not limited

`
private async Task ProxyServer_BeforeRequest(object sender, SessionEventArgs e)
{
if (ClientConnectionCount <= 100)
{

        SessionListItem item = null;
            await Dispatcher.InvokeAsync(() => { item = addSession(e); });

            if (e.HttpClient.Request.HasBody)
            {
                e.HttpClient.Request.KeepBody = true;
                await e.GetRequestBody();

                if (item == SelectedSession)
                {
                    await Dispatcher.InvokeAsync(selectedSessionChanged);
                }
            }
        }
        else
        {
            var res = new Response();
            res.StatusCode = 400;
            res.StatusDescription = "Limit Exceeded";
            e.Respond(res, true);
    
        }
    }`
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant