amnesia-spelos / amnesia-spelos/streamnesia

IOException when .NET client disconnects from a live server

Aberta
#50 0 comentários 0 reações 0 responsáveis Ver no GitHub
C# low priority
Linguagem predominante
C#
Estrelas
4
Forks
3
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

## Summary

The .NET client is unable to disconnect from the game server gracefully. Upon disconnecting, the AmnesiaClient's `ReadLine` throws an `IOException` despite attempting to be cancelled using a `CancellationToken`.

This is not graceful, however, it doesn't affect the usability of the application and can be fixed ad-hoc.

## How to Reproduce

1. Open the game client
2. Open Streamnesia.WebApp
3. Connect to the game client
4. Go back to Streamnesia
5. Disconnect from the game client
6. Exception should be logged

## Exception Thrown

```log
fail: Streamnesia.Execution.AmnesiaClient[0]
Failed to read the next client line.
System.IO.IOException: Unable to read data from the transport connection: The I/O operation has been aborted because of either a thread exit or an application request..
---> System.Net.Sockets.SocketException (995): The I/O operation has been aborted because of either a thread exit or an application request.
--- End of inner exception stack trace ---
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
at System.IO.StreamReader.ReadBufferAsync(CancellationToken cancellationToken)
at System.IO.StreamReader.ReadLineAsyncInternal(CancellationToken cancellationToken)
at Streamnesia.Execution.AmnesiaClient.ReadNextLineSafe(CancellationToken cancellationToken) in C:\Users\spelos\source\repos\spelos\streamnesia\src\Streamnesia.Execution\AmnesiaClient.cs:line 122
```

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.