Skip to content

Commit af3f8b0

Browse files
committed
fix cv2 connection
1 parent db06c98 commit af3f8b0

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

controller/CV2.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,11 @@ CV2::CV2(const Identity &myId, const char *path, int listenPort)
4747
, _waitNoticePrinted(false)
4848
, _listenPort(listenPort)
4949
{
50+
fprintf(stderr, "CV2::CV2\n");
5051
char myAddress[64];
5152
_myAddressStr = myId.address().toString(myAddress);
5253

53-
// replace cv2: with postgres: for the path/connstring
54-
std::string _path(path);
55-
if (_path.length() > 4 && _path.substr(0, 4) == "cv2:") {
56-
_path = "postgres:" + _path.substr(4);
57-
}
58-
_connString = std::string(_path);
54+
_connString = std::string(path);
5955

6056
auto f = std::make_shared<PostgresConnFactory>(_connString);
6157
_pool = std::make_shared<ConnectionPool<PostgresConnection> >(

controller/EmbeddedNetworkController.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,11 +534,16 @@ void EmbeddedNetworkController::init(const Identity &signingId,Sender *sender)
534534
_signingIdAddressString = signingId.address().toString(tmp);
535535

536536
#ifdef ZT_CONTROLLER_USE_LIBPQ
537+
fprintf(stderr, "path: %s\n", _path.c_str());
538+
fprintf(stderr, "substr: %s\n", _path.substr(0,3).c_str());
537539
if ((_path.length() > 9)&&(_path.substr(0,9) == "postgres:")) {
540+
fprintf(stderr, "CV1\n");
538541
_db.addDB(std::shared_ptr<DB>(new CV1(_signingId,_path.substr(9).c_str(), _listenPort, _rc)));
539-
} else if ((_path.length() > 3)&&(_path.substr(0,3) == "cv2:")) {
540-
_db.addDB(std::shared_ptr<DB>(new CV2(_signingId,_path.c_str(),_listenPort)));
542+
} else if ((_path.length() > 4)&&(_path.substr(0,4) == "cv2:")) {
543+
fprintf(stderr, "CV2\n");
544+
_db.addDB(std::shared_ptr<DB>(new CV2(_signingId,_path.substr(4).c_str(),_listenPort)));
541545
} else {
546+
fprintf(stderr, "FileDB\n");
542547
#endif
543548
_db.addDB(std::shared_ptr<DB>(new FileDB(_path.c_str())));
544549
#ifdef ZT_CONTROLLER_USE_LIBPQ

0 commit comments

Comments
 (0)