Skip to content

Commit

Permalink
fix: 修复误将 TokenManager.Token.token(string) 误当作 TokenManager.Token(Tok…
Browse files Browse the repository at this point in the history
…en) 使用导致无法与主控建立连接的问题
  • Loading branch information
SALTWOOD committed Mar 5, 2024
1 parent 58db1c8 commit 470ee50
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions CSharp-OpenBMCLAPI/Modules/Cluster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,6 @@ public Cluster(ClusterInfo info, TokenManager token) : base()
// Fetch 一下以免出现问题
this.token.FetchToken().Wait();

this.socket = new(HttpRequest.client.BaseAddress?.ToString(), new SocketIOOptions()
{
Transport = SocketIOClient.Transport.TransportProtocol.WebSocket,
Auth = new
{
token = token.Token
}
});

this.socket.ConnectAsync().Wait();

Check warning on line 40 in CSharp-OpenBMCLAPI/Modules/Cluster.cs

View workflow job for this annotation

GitHub Actions / build (Debug)

Dereference of a possibly null reference.

Check warning on line 40 in CSharp-OpenBMCLAPI/Modules/Cluster.cs

View workflow job for this annotation

GitHub Actions / build (Debug)

Dereference of a possibly null reference.

Check warning on line 40 in CSharp-OpenBMCLAPI/Modules/Cluster.cs

View workflow job for this annotation

GitHub Actions / build (Release)

Dereference of a possibly null reference.

Check warning on line 40 in CSharp-OpenBMCLAPI/Modules/Cluster.cs

View workflow job for this annotation

GitHub Actions / build (Release)

Dereference of a possibly null reference.

this.socket.On("error", error => HandleError(error));
Expand Down Expand Up @@ -100,6 +91,18 @@ protected async Task<int> AsyncRun()
return returns;
}

public async Task Connect()

Check warning on line 94 in CSharp-OpenBMCLAPI/Modules/Cluster.cs

View workflow job for this annotation

GitHub Actions / build (Debug)

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 94 in CSharp-OpenBMCLAPI/Modules/Cluster.cs

View workflow job for this annotation

GitHub Actions / build (Debug)

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 94 in CSharp-OpenBMCLAPI/Modules/Cluster.cs

View workflow job for this annotation

GitHub Actions / build (Release)

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 94 in CSharp-OpenBMCLAPI/Modules/Cluster.cs

View workflow job for this annotation

GitHub Actions / build (Release)

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
{
this.socket = new(HttpRequest.client.BaseAddress?.ToString(), new SocketIOOptions()
{
Transport = SocketIOClient.Transport.TransportProtocol.WebSocket,
Auth = new
{
token = token.Token.token
}
});
}

public async Task Enable()
{
await socket.EmitAsync("enable",
Expand Down

0 comments on commit 470ee50

Please sign in to comment.