Skip to content

Commit

Permalink
fix(lib): redis connection fail with retry
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaojiuwo1993 committed Oct 24, 2023
1 parent 548d947 commit 36daaaf
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Libraries/Core/src/Config/UniSpyConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class UniSpyDatabaseConfig
}
public class UniSpyRedisConfig
{
public string ConnectionString => $"{Server}:{Port},user={User},password={Password},ssl={SSL},sslHost={SSLHost}";
public string ConnectionString => $"{Server}:{Port},user={User},password={Password},ssl={SSL},sslHost={SSLHost},abortConnect=false";
public string Server;
public int Port;
public string User;
Expand Down
21 changes: 15 additions & 6 deletions src/Servers/QueryReport/src/Application/Client.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System.Text;
using System;
using UniSpy.Server.Core.Abstraction.BaseClass;
using UniSpy.Server.Core.Abstraction.Interface;
using UniSpy.Server.QueryReport.V2.Handler;
using UniSpy.Server.Core.Encryption;

namespace UniSpy.Server.QueryReport.Application
{
Expand All @@ -9,13 +11,20 @@ public sealed class Client : ClientBase
public Client(IConnection connection, IServer server) : base(connection, server)
{
IsLogRaw = true;
// launch redis channel
Info = new ClientInfo();
}

public new ClientInfo Info { get => (ClientInfo)base.Info; private set => base.Info = value; }


protected override ISwitcher CreateSwitcher(object buffer) => new CmdSwitcher(this, (byte[])buffer);
protected override ISwitcher CreateSwitcher(object buffer)
{
var data = (byte[])buffer;
if (data[0] == Convert.ToInt32('\\'))
{
return new V1.Handler.CmdSwitcher(this, UniSpyEncoding.GetString(data));
}
else
{
return new V2.Handler.CmdSwitcher(this, data);
}
}
}
}
2 changes: 1 addition & 1 deletion src/Servers/QueryReport/src/V1/Handler/CmdSwitcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public sealed class CmdSwitcher : CmdSwitcherBase
{
private new string _rawRequest => (string)base._rawRequest;
private new Client _client => (Client)base._client;
public CmdSwitcher(Client client, object rawRequest) : base(client, rawRequest)
public CmdSwitcher(Client client, string rawRequest) : base(client, rawRequest)
{
}

Expand Down

0 comments on commit 36daaaf

Please sign in to comment.