amnesia-spelos / amnesia-spelos/streamnesia

IOException when .NET client disconnects from a live server

Abierto
#50 0 comentarios 0 reacciones 0 asignados Ver en GitHub
C# low priority
Lenguaje dominante
C#
Estrellas
4
Forks
3
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.