Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Update connections.cc
Browse files Browse the repository at this point in the history
Change to runtime init of version from module init
  • Loading branch information
meahoibm committed Feb 3, 2022
1 parent 03eb299 commit 6a218bb
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions bb/src/connections.cc
Original file line number Diff line number Diff line change
Expand Up @@ -327,22 +327,22 @@ int setupWhoami(string whoami, string instance)
\brief Connection authentication response handler
*/
static boost::property_tree::ptree myV;
static bool myV_set = false;
boost::property_tree::ptree getVersionPropertyTree(){
if (!myV_set){
bbVersionToTree(BBAPI_CLIENTVERSIONSTR, myV);
myV_set=true;
}
return myV;
}

static bool myVersionInit(){
bbVersionToTree(BBAPI_CLIENTVERSIONSTR, myV);
return true;
}
static bool myV_set = myVersionInit();

int versionCheck(const std::string& pReceivedVersion){
auto vt = getVersionPropertyTree();
boost::property_tree::ptree receivedV;

bbVersionToTree(pReceivedVersion, receivedV);

std::string myVersionString = myV.get("version.major", "NOTFOUND_"+process_whoami);
std::string myVersionString = vt.get("version.major", "NOTFOUND_"+process_whoami);
if(myVersionString != receivedV.get("version.major", "xyz"))
{
stringstream errorText;
Expand All @@ -352,7 +352,7 @@ int versionCheck(const std::string& pReceivedVersion){
bberror << err("error.whoami", process_whoami);
SET_RC_RAS_AND_BAIL(-1, bb.cfgerr.versionmismatch);
}
if( myV.get("gitcommit", "commit_NOTFOUND_"+process_whoami) != receivedV.get("gitcommit", "xyz"))
if( vt.get("gitcommit", "commit_NOTFOUND_"+process_whoami) != receivedV.get("gitcommit", "xyz"))
LOG(bb,info)<<"gitcommit levels are different, received="<<pReceivedVersion<<" my Version="<<BBAPI_CLIENTVERSIONSTR;
return 0;
}
Expand Down

0 comments on commit 6a218bb

Please sign in to comment.