Skip to content

Commit

Permalink
[OneBot] Fix Corruption of ForwardWSService.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
Linwenxuan04 committed Feb 23, 2024
1 parent 0a3e8cf commit a2cc884
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions Lagrange.OneBot/Core/Network/Service/ForwardWSService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,17 @@ public async ValueTask SendJsonAsync<T>(T json, string? identifier = null, Cance

private void OnHeartbeat(object? _, string identifier)
{
var status = new OneBotStatus(true, true);
var heartBeat = new OneBotHeartBeat(_context.BotUin, (int)_options.HeartBeatInterval, status);
try
{
var status = new OneBotStatus(true, true);
var heartBeat = new OneBotHeartBeat(_context.BotUin, (int)_options.HeartBeatInterval, status);

SendJsonAsync(heartBeat, identifier).GetAwaiter().GetResult();
SendJsonAsync(heartBeat, identifier).GetAwaiter().GetResult();
}
catch
{
// ignored
}
}

private static bool IsPortInUse(uint port) =>
Expand Down

0 comments on commit a2cc884

Please sign in to comment.