Example #1
0
    public long _6_2_ExceededSocketShouldStacked(Disquuun disquuun)
    {
        WaitUntil("_6_2_ExceededSocketShouldStacked", () => (disquuun.State() == Disquuun.ConnectionState.OPENED), 5);

        var queueId   = Guid.NewGuid().ToString();
        var infoCount = 0;

        var connectCount = 1000;
        var w            = new Stopwatch();

        w.Start();
        for (var i = 0; i < connectCount; i++)
        {
            disquuun.Info().Async(
                (command, data) =>
            {
                lock (_6_2_ExceededSocketShouldStackedLockObject) infoCount++;
            }
                );
        }

        var stackedCommandCount = disquuun.StackedCommandCount();

        // this assert "maybe" hit. not hit if sockets can run so fast.
        Assert("_6_2_ExceededSocketShouldStacked", 0 < stackedCommandCount, "not match, " + stackedCommandCount);
        WaitUntil("_6_2_ExceededSocketShouldStacked", () => (infoCount == connectCount), 5);
        w.Stop();
        return(w.ElapsedMilliseconds);
    }
Example #2
0
    public void _6_2_ExceededSocketShouldStacked(Disquuun disquuun)
    {
        WaitUntil("_6_2_ExceededSocketShouldStacked", () => (disquuun.State() == Disquuun.ConnectionState.OPENED), 5);

        var queueId   = Guid.NewGuid().ToString();
        var infoCount = 0;

        var connectCount = 1000;

        for (var i = 0; i < connectCount; i++)
        {
            disquuun.Info().Async(
                (command, data) => {
                lock (_6_2_ExceededSocketShouldStackedLockObject) infoCount++;
            }
                );
        }

        var stackedCommandCount = disquuun.StackedCommandCount();

        Assert("_6_2_ExceededSocketShouldStacked", 0 < stackedCommandCount, "not match, " + stackedCommandCount);
        WaitUntil("_6_2_ExceededSocketShouldStacked", () => (infoCount == connectCount), 5);
    }