From 13cf2cf36d5156a79d9fe0c9b46fbed896667f00 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Mon, 14 Nov 2016 18:39:56 -0800 Subject: [PATCH] Connect DB using DBConnector::DEFAULT_UNIXSOCKET (#126) --- lib/src/sai_redis_interfacequery.cpp | 7 +++---- saidump/saidump.cpp | 2 +- syncd/syncd.cpp | 7 +++---- syncd/syncd_counters.cpp | 4 ++-- syncd/syncd_request_shutdown.cpp | 2 +- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/lib/src/sai_redis_interfacequery.cpp b/lib/src/sai_redis_interfacequery.cpp index 95c293e78cdd..3b64518cddce 100644 --- a/lib/src/sai_redis_interfacequery.cpp +++ b/lib/src/sai_redis_interfacequery.cpp @@ -1,6 +1,5 @@ -#include "sai_redis.h" - #include +#include "sai_redis.h" std::mutex g_mutex; std::mutex g_apimutex; @@ -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; diff --git a/saidump/saidump.cpp b/saidump/saidump.cpp index 3a73f0c3534b..01b70998a3ce 100644 --- a/saidump/saidump.cpp +++ b/saidump/saidump.cpp @@ -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"); diff --git a/syncd/syncd.cpp b/syncd/syncd.cpp index 96b46372f491..0078ac49542d 100644 --- a/syncd/syncd.cpp +++ b/syncd/syncd.cpp @@ -1,8 +1,7 @@ +#include #include "syncd.h" #include "sairedis.h" -#include - std::mutex g_mutex; swss::RedisClient *g_redisClient = NULL; @@ -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); diff --git a/syncd/syncd_counters.cpp b/syncd/syncd_counters.cpp index bfc1a6a1dd68..824b92011de3 100644 --- a/syncd/syncd_counters.cpp +++ b/syncd/syncd_counters.cpp @@ -1,6 +1,6 @@ -#include "syncd.h" #include #include +#include "syncd.h" void collectCounters(swss::Table &countersTable, const std::vector &supportedCounters) @@ -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(); diff --git a/syncd/syncd_request_shutdown.cpp b/syncd/syncd_request_shutdown.cpp index 8fc2debe1a6e..959dc1a12373 100644 --- a/syncd/syncd_request_shutdown.cpp +++ b/syncd/syncd_request_shutdown.cpp @@ -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 values;