Skip to content

loosing handles (just on some systems) #69

Description

@SHirsch78

On some systems sending a message increases handle count by 1 per message. After hours of running the application crashes.

When I change the last lines in file WebSocketDeflateWriteStream.cs no handles are lost anymore.

public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
{
    if (buffer == null) throw new ArgumentNullException(nameof(buffer));
    if (offset < 0 || offset > buffer.Length) throw new ArgumentOutOfRangeException(nameof(offset));
    if (count < 0 || offset + count > buffer.Length) throw new ArgumentOutOfRangeException(nameof(count));

    if (count == 0)
    {
        return Task.FromResult(0);
    }
     
    //original code
    //return this.deflateStream.WriteAsync(buffer, offset, count, cancellationToken);

    //new code
    this.deflateStream.Write(buffer, offset, count);
    return Task.FromResult(0);
}

I do not really understand the underlying problem. So my solution might not be good one because it is not async. But for my scenarios it work fine.
So maybe someone has a better solution for that.
Regards

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions