Skip to content

Commit 13cf2cf

Browse files
qiluo-msftShuotian Cheng
authored andcommitted
Connect DB using DBConnector::DEFAULT_UNIXSOCKET (sonic-net#126)
1 parent 1f746ab commit 13cf2cf

5 files changed

Lines changed: 10 additions & 12 deletions

File tree

lib/src/sai_redis_interfacequery.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#include "sai_redis.h"
2-
31
#include <string.h>
2+
#include "sai_redis.h"
43

54
std::mutex g_mutex;
65
std::mutex g_apimutex;
@@ -43,12 +42,12 @@ sai_status_t sai_api_initialize(
4342
if (g_db != NULL)
4443
delete g_db;
4544

46-
g_db = new swss::DBConnector(ASIC_DB, "localhost", 6379, 0);
45+
g_db = new swss::DBConnector(ASIC_DB, swss::DBConnector::DEFAULT_UNIXSOCKET, 0);
4746

4847
if (g_dbNtf != NULL)
4948
delete g_dbNtf;
5049

51-
g_dbNtf = new swss::DBConnector(ASIC_DB, "localhost", 6379, 0);
50+
g_dbNtf = new swss::DBConnector(ASIC_DB, swss::DBConnector::DEFAULT_UNIXSOCKET, 0);
5251

5352
if (g_asicState != NULL)
5453
delete g_asicState;

saidump/saidump.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ int main(int argc, char ** argv)
180180

181181
g_cmdOptions = handleCmdLine(argc, argv);
182182

183-
swss::DBConnector db(ASIC_DB, "localhost", 6379, 0);
183+
swss::DBConnector db(ASIC_DB, DBConnector::DEFAULT_UNIXSOCKET, 0);
184184

185185
swss::Table t(&db, "ASIC_STATE");
186186

syncd/syncd.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1+
#include <iostream>
12
#include "syncd.h"
23
#include "sairedis.h"
34

4-
#include <iostream>
5-
65
std::mutex g_mutex;
76

87
swss::RedisClient *g_redisClient = NULL;
@@ -1281,8 +1280,8 @@ int main(int argc, char **argv)
12811280
}
12821281
#endif // SAITHRIFT
12831282

1284-
swss::DBConnector *db = new swss::DBConnector(ASIC_DB, "localhost", 6379, 0);
1285-
swss::DBConnector *dbNtf = new swss::DBConnector(ASIC_DB, "localhost", 6379, 0);
1283+
swss::DBConnector *db = new swss::DBConnector(ASIC_DB, swss::DBConnector::DEFAULT_UNIXSOCKET, 0);
1284+
swss::DBConnector *dbNtf = new swss::DBConnector(ASIC_DB, swss::DBConnector::DEFAULT_UNIXSOCKET, 0);
12861285

12871286
g_redisClient = new swss::RedisClient(db);
12881287

syncd/syncd_counters.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#include "syncd.h"
21
#include <condition_variable>
32
#include <sstream>
3+
#include "syncd.h"
44

55
void collectCounters(swss::Table &countersTable,
66
const std::vector<sai_port_stat_counter_t> &supportedCounters)
@@ -97,7 +97,7 @@ void collectCountersThread(int intervalInSeconds)
9797
{
9898
SWSS_LOG_ENTER();
9999

100-
swss::DBConnector db(COUNTERS_DB, "localhost", 6379, 0);
100+
swss::DBConnector db(COUNTERS_DB, swss::DBConnector::DEFAULT_UNIXSOCKET, 0);
101101
swss::Table countersTable(&db, "COUNTERS");
102102

103103
auto ports = saiGetPortList();

syncd/syncd_request_shutdown.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ int main(int argc, char **argv)
6161
exit(EXIT_FAILURE);
6262
}
6363

64-
swss::DBConnector db(ASIC_DB, "localhost", 6379, 0);
64+
swss::DBConnector db(ASIC_DB, swss::DBConnector::DEFAULT_UNIXSOCKET, 0);
6565
swss::NotificationProducer restartQuery(&db, "RESTARTQUERY");
6666

6767
std::vector<swss::FieldValueTuple> values;

0 commit comments

Comments
 (0)