Skip to content

Manage connection #2

Open
Open

Description

@dimaaan

from @Ruhrpottpatriot:
I find it a bit counter intuitive, how you handled the keep alive process. If I understood it correctly, you call OpenAnsyc() and that Task only completes when the connection is closed.

Maybe change the code, so that every public async method accepts a CancellationToken and the receive Task is decoupled from ConnectAsync().

TaskCompletionSource could be an option. I'll look into it.

Activity

  1. Ruhrpottpatriot commented on Oct 11, 2017

    @Ruhrpottpatriot
    Contributor

    Additional information regarding a CancellationToken:

    In TAP, cancellation is optional for both asynchronous method implementers and asynchronous method consumers. If an operation allows cancellation, it exposes an overload of the asynchronous method that accepts a cancellation token (CancellationToken instance). By convention, the parameter is named cancellationToken.

    From: https://docs.microsoft.com/en-us/dotnet/standard/asynchronous-programming-patterns/task-based-asynchronous-pattern-tap

  2. Ruhrpottpatriot commented on Oct 17, 2017

    @Ruhrpottpatriot
    Contributor

    I also would suggest, that we add a new boolean property indicating whether the connection is open or not.

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