LavalinkNodeConnection's IsConnected still returns false after a successful reconnection
Created by: alexhorner
Summary
After a LavalinkNodeConnection
has lost connection to its node, the IsConnected
property remains false
even if a successful reconnection has occured.
Details
Running on 4.0.0-rc2
packages across the board, .NET Core 3.1 on Windows 10 using Jetbrains Rider
Steps to reproduce
- Establish a connection to a node and get the resulting
LavalinkNodeConnection
- Check
IsConnected
, it will betrue
- Kill LavaLink so that the connection is lost
- Check
IsConnected
, it will befalse
- Start LavaLink and wait for it to accept the connection
- Check
IsConnected
, it will befalse
when it should betrue
Notes
I have looked at https://github.com/DSharpPlus/DSharpPlus/blob/7201d25c858e417097c297cec79477e9f334f8e2/DSharpPlus.Lavalink/LavalinkNodeConnection.cs and think I have identified the issue. Please could you triple check my findings?
(Looking in LavalinkNodeConnection.cs) It appears _isDisposed
has an initial value of false
as would be expected and is also set to false
once again in the class constructor.
After a disconnect has occured, _isDisposed
is set to true
and StartAsync
is called.
When a connection has been established once again by StartAsync
, the value of _isDisposed
is not updated to false
therefore checking IsConnected
returns false, even though a new connection has been established making the LavalinkNodeConnection
usable again.