|
|
|
|
|
|
|
|
UtilityConfig::LoadCredentials(void) {
|
|
|
UtilityConfig::LoadCredentials(void) {
|
|
|
|
|
|
|
|
|
if(0 < CFGData.node_identity.length()) { // If an identity path was provided
|
|
|
if(0 < CFGData.node_identity.length()) { // If an identity path was provided
|
|
|
ConfigurationData Identity(CFGData.node_identity.c_str()); // then get the data from that file.
|
|
|
|
|
|
ConfigurationElement IdentityReader("snf"); // Create an Identity reader and
|
|
|
|
|
|
|
|
|
codedweller::ConfigurationData Identity(CFGData.node_identity.c_str()); // then get the data from that file.
|
|
|
|
|
|
codedweller::ConfigurationElement IdentityReader("snf"); // Create an Identity reader and
|
|
|
IdentityReader // configure it.
|
|
|
IdentityReader // configure it.
|
|
|
.Element("identity")
|
|
|
.Element("identity")
|
|
|
.Attribute("licenseid", CFGData.node_licenseid)
|
|
|
.Attribute("licenseid", CFGData.node_licenseid)
|
|
|
|
|
|
|
|
|
memset(ResultBuffer, 0, sizeof(ResultBuffer)); // Set the entire thing to nulls.
|
|
|
memset(ResultBuffer, 0, sizeof(ResultBuffer)); // Set the entire thing to nulls.
|
|
|
|
|
|
|
|
|
const int Tries = 20; // How many times to try this.
|
|
|
const int Tries = 20; // How many times to try this.
|
|
|
Sleeper SleepAfterAttempt(100); // How long to sleep between attempts.
|
|
|
|
|
|
|
|
|
codedweller::Sleeper SleepAfterAttempt(100); // How long to sleep between attempts.
|
|
|
|
|
|
|
|
|
const int OpenTries = 90; // How many tries at opening.
|
|
|
const int OpenTries = 90; // How many tries at opening.
|
|
|
Sleeper WaitForOpen(10); // How long to wait for an open cycle.
|
|
|
|
|
|
|
|
|
codedweller::Sleeper WaitForOpen(10); // How long to wait for an open cycle.
|
|
|
|
|
|
|
|
|
const int ReadTries = 900; // How many tries at reading.
|
|
|
const int ReadTries = 900; // How many tries at reading.
|
|
|
Sleeper SleepBeforeReading(10); // How long to pause before reading.
|
|
|
|
|
|
|
|
|
codedweller::Sleeper SleepBeforeReading(10); // How long to pause before reading.
|
|
|
|
|
|
|
|
|
/*
|
|
|
/*
|
|
|
** 20 * 100ms = 2 seconds for all tries.
|
|
|
** 20 * 100ms = 2 seconds for all tries.
|
|
|
|
|
|
|
|
|
for(int tryagain = Tries; (0<tryagain) && (!ConnectSuccess); tryagain--) { // Try a few times to get this done.
|
|
|
for(int tryagain = Tries; (0<tryagain) && (!ConnectSuccess); tryagain--) { // Try a few times to get this done.
|
|
|
try {
|
|
|
try {
|
|
|
ResultString = ""; // Clear our result string.
|
|
|
ResultString = ""; // Clear our result string.
|
|
|
TCPHost SNFServer(9001); // Create connection to server.
|
|
|
|
|
|
|
|
|
codedweller::TCPHost SNFServer(9001); // Create connection to server.
|
|
|
SNFServer.makeNonBlocking(); // Make it non-blocking.
|
|
|
SNFServer.makeNonBlocking(); // Make it non-blocking.
|
|
|
|
|
|
|
|
|
for(int tries = OpenTries; 0 < tries; tries--) { // Wait & Watch for a good connection.
|
|
|
for(int tries = OpenTries; 0 < tries; tries--) { // Wait & Watch for a good connection.
|
|
|
|
|
|
|
|
|
bool IncreasedTimeoutTime = false; // TimeoutTime_msec can be increased
|
|
|
bool IncreasedTimeoutTime = false; // TimeoutTime_msec can be increased
|
|
|
// only once if the log file name changes.
|
|
|
// only once if the log file name changes.
|
|
|
std::string NewLogFileName;
|
|
|
std::string NewLogFileName;
|
|
|
Sleeper Sleep(SleepTime_msec);
|
|
|
|
|
|
|
|
|
codedweller::Sleeper Sleep(SleepTime_msec);
|
|
|
std::string FinalContents;
|
|
|
std::string FinalContents;
|
|
|
|
|
|
|
|
|
Sleep();
|
|
|
Sleep();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
ConfigurationElement MyCFGReader("stats"); // Object to parse the XML.
|
|
|
|
|
|
ConfigurationData MyCFGData(StatusReport.c_str(), StatusReport.length()); // Object that contains the XML.
|
|
|
|
|
|
|
|
|
codedweller::ConfigurationElement MyCFGReader("stats"); // Object to parse the XML.
|
|
|
|
|
|
codedweller::ConfigurationData MyCFGData(StatusReport.c_str(), StatusReport.length()); // Object that contains the XML.
|
|
|
|
|
|
|
|
|
std::string PlatformContent;
|
|
|
std::string PlatformContent;
|
|
|
|
|
|
|