Skip to content

StreamProvider : Impossible to create a new stream if the previous one was not retrieved. #724

@mohdje

Description

@mohdje

Here is the issue:

  • I have a torrent with multiple files
  • I try to stream a file (torrentManagerFile1) using this piece of code :
    await torrentManager.StreamProvider.CreateStreamAsync(torrentManagerFile1, true, cancellationToken);
  • I cancel the Task before ActiveStream is returned from CreateStreamAsync().
  • Then if I try to stream another file (torrentManagerFile2) from same torrent calling:
    await torrentManager.StreamProvider.CreateStreamAsync(torrentManagerFile2, true, cancellationToken);
    The following error is thrown
    InvalidOperationException ("You must Dispose the previous stream before creating a new one.")
  • Looking at the code of StreamProvider.CreateStreamAsync() it seems that if the task is canceled the ActiveStream still has the Disposed property to false, so this is why the issue occurs.

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