!67 fix: 服务端WebSocket使用AsyncClose()主动关闭连接时引发NullReferenceException异常

Merge pull request !67 from 千层饼/master
This commit is contained in:
若汝棋茗
2025-04-15 15:09:49 +00:00
committed by Gitee

View File

@@ -76,11 +76,17 @@ internal sealed partial class InternalWebSocket : IWebSocket
await this.SendAsync(frame).ConfigureAwait(EasyTask.ContinueOnCapturedContext);
}
}
await this.m_httpClientBase.ShutdownAsync(System.Net.Sockets.SocketShutdown.Both);
await this.m_httpClientBase.SafeCloseAsync(statusDescription).ConfigureAwait(EasyTask.ContinueOnCapturedContext);
await this.m_httpSocketClient.ShutdownAsync(System.Net.Sockets.SocketShutdown.Both);
await this.m_httpSocketClient.SafeCloseAsync(statusDescription).ConfigureAwait(EasyTask.ContinueOnCapturedContext);
if (this.m_isServer)
{
await this.m_httpSocketClient.ShutdownAsync(System.Net.Sockets.SocketShutdown.Both);
await this.m_httpSocketClient.SafeCloseAsync(statusDescription).ConfigureAwait(EasyTask.ContinueOnCapturedContext);
}
else
{
await this.m_httpClientBase.ShutdownAsync(System.Net.Sockets.SocketShutdown.Both);
await this.m_httpClientBase.SafeCloseAsync(statusDescription).ConfigureAwait(EasyTask.ContinueOnCapturedContext);
}
}
public async Task PingAsync()