amnesia-spelos / amnesia-spelos/streamnesia

IOException when .NET client disconnects from a live server

Aperta
#50 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
C# low priority
Lingua principale
C#
Stelle
4
Fork
3
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

## 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
```

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.