Bug fix: Can't reconnect after connection lost

This commit is contained in:
BruceChen 2022-08-31 22:32:38 +08:00
parent db64515b78
commit 98dd645fb5
4 changed files with 31 additions and 18 deletions

View file

@ -446,6 +446,8 @@ namespace MinecraftClient
/// </summary>
public void OnConnectionLost(ChatBot.DisconnectReason reason, string message)
{
handler.Dispose();
world.Clear();
if (timeoutdetector != null)
@ -761,7 +763,7 @@ namespace MinecraftClient
int callingThreadId = Thread.CurrentThread.ManagedThreadId;
if (handler != null)
{
return handler.GetNetReadThreadId() != callingThreadId;
return handler.GetNetMainThreadId() != callingThreadId;
}
else
{