Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
aditydha committed Apr 8, 2024
1 parent 554c606 commit 419e38d
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Ginger/GingerCoreNET/Database/NoSqlBase/GingerCassandra.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,32 +39,32 @@ public class GingerCassandra : NoSqlBase
ActDBValidation Act = null;
dynamic myclass = null;
string mUDTName = null;
private SSLOptions sslOptions;

public override bool Connect()
{
try
{
const string queryTimeoutString = "querytimeout=";
const string sslString = "ssl=";
string sslValue = null;
int queryTimeout = 20000;//default timeout (20 seconds).
string[] queryArray = Db.DatabaseOperations.TNSCalculated.Split(';');
if (queryArray[1].ToLower().Contains(queryTimeoutString))
{
string queryTimeoutValue = queryArray[1].Substring(queryArray[1].ToLower().IndexOf(queryTimeoutString) + queryTimeoutString.Length);
queryTimeout = Convert.ToInt32(queryTimeoutValue) * 1000;
}
SSLOptions sslOptions=null;
try
{
if (queryArray[2].ToLower().Contains(sslString))
{
sslValue = queryArray[2].Substring(queryArray[2].ToLower().IndexOf(sslString) + sslString.Length);
string sslValue = queryArray[2].Substring(queryArray[2].ToLower().IndexOf(sslString) + sslString.Length);
sslOptions = new SSLOptions(
Enum.Parse<SslProtocols>(sslValue), false,
(_, certificate, chain, errors) => { return true; });

Check notice on line 64 in Ginger/GingerCoreNET/Database/NoSqlBase/GingerCassandra.cs

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

Ginger/GingerCoreNET/Database/NoSqlBase/GingerCassandra.cs#L64

'certificate' is not used. Use discard parameter instead.

}
var sslOptions = new SSLOptions(
Enum.Parse<SslProtocols>(sslValue), false,
(sender, certificate, chain, errors) => { return true; });

}
catch (Exception e)
{
Expand All @@ -78,12 +78,12 @@ public override bool Connect()
{
if (string.IsNullOrEmpty(Db.Pass) && string.IsNullOrEmpty(Db.User))
{
if (string.IsNullOrEmpty(sslValue))
if (sslOptions ==null)
{
cluster = Cluster.Builder().AddContactPoint(HostPort[0]).WithPort(Int32.Parse(HostPort[1])).WithQueryTimeout(queryTimeout).Build();
}
else
{
{
cluster = Cluster.Builder()
.AddContactPoint(HostPort[0])
.WithPort(Int32.Parse(HostPort[1]))
Expand All @@ -94,7 +94,7 @@ public override bool Connect()
}
else
{
if (string.IsNullOrEmpty(sslValue)) {
if (sslOptions == null) {
cluster = Cluster.Builder().WithCredentials(Db.User.ToString(), Db.Pass.ToString()).AddContactPoint(HostPort[0]).WithPort(Int32.Parse(HostPort[1])).WithQueryTimeout(queryTimeout).Build();
}
else
Expand Down

0 comments on commit 419e38d

Please sign in to comment.