Skip to content

Commit

Permalink
Connect DB using DBConnector::DEFAULT_UNIXSOCKET (sonic-net#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
qiluo-msft authored and Shuotian Cheng committed Nov 15, 2016
1 parent 1f746ab commit 13cf2cf
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
7 changes: 3 additions & 4 deletions lib/src/sai_redis_interfacequery.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "sai_redis.h"

#include <string.h>
#include "sai_redis.h"

std::mutex g_mutex;
std::mutex g_apimutex;
Expand Down Expand Up @@ -43,12 +42,12 @@ sai_status_t sai_api_initialize(
if (g_db != NULL)
delete g_db;

g_db = new swss::DBConnector(ASIC_DB, "localhost", 6379, 0);
g_db = new swss::DBConnector(ASIC_DB, swss::DBConnector::DEFAULT_UNIXSOCKET, 0);

if (g_dbNtf != NULL)
delete g_dbNtf;

g_dbNtf = new swss::DBConnector(ASIC_DB, "localhost", 6379, 0);
g_dbNtf = new swss::DBConnector(ASIC_DB, swss::DBConnector::DEFAULT_UNIXSOCKET, 0);

if (g_asicState != NULL)
delete g_asicState;
Expand Down
2 changes: 1 addition & 1 deletion saidump/saidump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ int main(int argc, char ** argv)

g_cmdOptions = handleCmdLine(argc, argv);

swss::DBConnector db(ASIC_DB, "localhost", 6379, 0);
swss::DBConnector db(ASIC_DB, DBConnector::DEFAULT_UNIXSOCKET, 0);

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

Expand Down
7 changes: 3 additions & 4 deletions syncd/syncd.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#include <iostream>
#include "syncd.h"
#include "sairedis.h"

#include <iostream>

std::mutex g_mutex;

swss::RedisClient *g_redisClient = NULL;
Expand Down Expand Up @@ -1281,8 +1280,8 @@ int main(int argc, char **argv)
}
#endif // SAITHRIFT

swss::DBConnector *db = new swss::DBConnector(ASIC_DB, "localhost", 6379, 0);
swss::DBConnector *dbNtf = new swss::DBConnector(ASIC_DB, "localhost", 6379, 0);
swss::DBConnector *db = new swss::DBConnector(ASIC_DB, swss::DBConnector::DEFAULT_UNIXSOCKET, 0);
swss::DBConnector *dbNtf = new swss::DBConnector(ASIC_DB, swss::DBConnector::DEFAULT_UNIXSOCKET, 0);

g_redisClient = new swss::RedisClient(db);

Expand Down
4 changes: 2 additions & 2 deletions syncd/syncd_counters.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "syncd.h"
#include <condition_variable>
#include <sstream>
#include "syncd.h"

void collectCounters(swss::Table &countersTable,
const std::vector<sai_port_stat_counter_t> &supportedCounters)
Expand Down Expand Up @@ -97,7 +97,7 @@ void collectCountersThread(int intervalInSeconds)
{
SWSS_LOG_ENTER();

swss::DBConnector db(COUNTERS_DB, "localhost", 6379, 0);
swss::DBConnector db(COUNTERS_DB, swss::DBConnector::DEFAULT_UNIXSOCKET, 0);
swss::Table countersTable(&db, "COUNTERS");

auto ports = saiGetPortList();
Expand Down
2 changes: 1 addition & 1 deletion syncd/syncd_request_shutdown.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ int main(int argc, char **argv)
exit(EXIT_FAILURE);
}

swss::DBConnector db(ASIC_DB, "localhost", 6379, 0);
swss::DBConnector db(ASIC_DB, swss::DBConnector::DEFAULT_UNIXSOCKET, 0);
swss::NotificationProducer restartQuery(&db, "RESTARTQUERY");

std::vector<swss::FieldValueTuple> values;
Expand Down

0 comments on commit 13cf2cf

Please sign in to comment.