mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-07-05 20:41:44 -07:00
fix cv2 connection
This commit is contained in:
parent
db06c98608
commit
af3f8b00a4
2 changed files with 9 additions and 8 deletions
|
@ -47,15 +47,11 @@ CV2::CV2(const Identity &myId, const char *path, int listenPort)
|
||||||
, _waitNoticePrinted(false)
|
, _waitNoticePrinted(false)
|
||||||
, _listenPort(listenPort)
|
, _listenPort(listenPort)
|
||||||
{
|
{
|
||||||
|
fprintf(stderr, "CV2::CV2\n");
|
||||||
char myAddress[64];
|
char myAddress[64];
|
||||||
_myAddressStr = myId.address().toString(myAddress);
|
_myAddressStr = myId.address().toString(myAddress);
|
||||||
|
|
||||||
// replace cv2: with postgres: for the path/connstring
|
_connString = std::string(path);
|
||||||
std::string _path(path);
|
|
||||||
if (_path.length() > 4 && _path.substr(0, 4) == "cv2:") {
|
|
||||||
_path = "postgres:" + _path.substr(4);
|
|
||||||
}
|
|
||||||
_connString = std::string(_path);
|
|
||||||
|
|
||||||
auto f = std::make_shared<PostgresConnFactory>(_connString);
|
auto f = std::make_shared<PostgresConnFactory>(_connString);
|
||||||
_pool = std::make_shared<ConnectionPool<PostgresConnection> >(
|
_pool = std::make_shared<ConnectionPool<PostgresConnection> >(
|
||||||
|
|
|
@ -534,11 +534,16 @@ void EmbeddedNetworkController::init(const Identity &signingId,Sender *sender)
|
||||||
_signingIdAddressString = signingId.address().toString(tmp);
|
_signingIdAddressString = signingId.address().toString(tmp);
|
||||||
|
|
||||||
#ifdef ZT_CONTROLLER_USE_LIBPQ
|
#ifdef ZT_CONTROLLER_USE_LIBPQ
|
||||||
|
fprintf(stderr, "path: %s\n", _path.c_str());
|
||||||
|
fprintf(stderr, "substr: %s\n", _path.substr(0,3).c_str());
|
||||||
if ((_path.length() > 9)&&(_path.substr(0,9) == "postgres:")) {
|
if ((_path.length() > 9)&&(_path.substr(0,9) == "postgres:")) {
|
||||||
|
fprintf(stderr, "CV1\n");
|
||||||
_db.addDB(std::shared_ptr<DB>(new CV1(_signingId,_path.substr(9).c_str(), _listenPort, _rc)));
|
_db.addDB(std::shared_ptr<DB>(new CV1(_signingId,_path.substr(9).c_str(), _listenPort, _rc)));
|
||||||
} else if ((_path.length() > 3)&&(_path.substr(0,3) == "cv2:")) {
|
} else if ((_path.length() > 4)&&(_path.substr(0,4) == "cv2:")) {
|
||||||
_db.addDB(std::shared_ptr<DB>(new CV2(_signingId,_path.c_str(),_listenPort)));
|
fprintf(stderr, "CV2\n");
|
||||||
|
_db.addDB(std::shared_ptr<DB>(new CV2(_signingId,_path.substr(4).c_str(),_listenPort)));
|
||||||
} else {
|
} else {
|
||||||
|
fprintf(stderr, "FileDB\n");
|
||||||
#endif
|
#endif
|
||||||
_db.addDB(std::shared_ptr<DB>(new FileDB(_path.c_str())));
|
_db.addDB(std::shared_ptr<DB>(new FileDB(_path.c_str())));
|
||||||
#ifdef ZT_CONTROLLER_USE_LIBPQ
|
#ifdef ZT_CONTROLLER_USE_LIBPQ
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue