Definition at line 385 of file OpenTransactions.cpp.
opentxs::OT_API::Pid::Pid |
( |
| ) |
|
opentxs::OT_API::Pid::~Pid |
( |
| ) |
|
void opentxs::OT_API::Pid::ClosePid |
( |
| ) |
|
Definition at line 513 of file OpenTransactions.cpp.
518 <<
": strPidFilePath is CLOSED, WHY CLOSE A PID IF NONE IS OPEN!\n";
521 if (!m_strPidFilePath.
Exists()) {
522 otErr << __FUNCTION__ <<
": m_strPidFilePath is Empty!\n";
533 std::ofstream pid_outfile(m_strPidFilePath.
Get());
535 if (pid_outfile.is_open()) {
536 uint32_t the_pid = 0;
537 pid_outfile << the_pid;
539 m_bIsPidOpen =
false;
542 otErr <<
"Failed trying to open data locking file (to wipe PID "
543 "back to 0): " << m_strPidFilePath <<
"\n";
EXPORT bool Exists() const
EXPORT const char * Get() const
OTLOG_IMPORT OTLogStream otErr
bool opentxs::OT_API::Pid::IsPidOpen |
( |
| ) |
const |
void opentxs::OT_API::Pid::OpenPid |
( |
const OTString & |
strPidFilePath | ) |
|
Definition at line 410 of file OpenTransactions.cpp.
413 otErr << __FUNCTION__ <<
": strPidFilePath is OPEN, MUST CLOSE BEFORE "
414 "OPENING A NEW ONE!\n";
418 if (!strPidFilePath.Exists()) {
419 otErr << __FUNCTION__ <<
": strPidFilePath is Empty!\n";
422 if (3 > strPidFilePath.GetLength()) {
423 otErr << __FUNCTION__ <<
": strPidFilePath is Too Short! ("
424 << strPidFilePath <<
")\n";
428 otWarn << __FUNCTION__ <<
": Using Pid File: " << strPidFilePath <<
"\n";
429 m_strPidFilePath = strPidFilePath;
448 std::ifstream pid_infile(m_strPidFilePath.
Get());
453 if (pid_infile.is_open())
455 uint32_t old_pid = 0;
456 pid_infile >> old_pid;
461 const uint64_t lPID = old_pid;
463 <<
"\n\n\nIS OPEN-TRANSACTIONS ALREADY RUNNING?\n\n"
464 "I found a PID (" << lPID
465 <<
") in the data lock file, located at: "
466 << m_strPidFilePath <<
"\n\n"
467 "If the OT process with PID " << lPID
468 <<
" is truly not running "
470 "then just erase that file and restart.\nThis is "
473 "up during AppCleanup / AppShutdown. (Or should be.)\n";
475 m_bIsPidOpen =
false;
488 uint64_t the_pid = 0;
491 the_pid = GetCurrentProcessId();
498 std::ofstream pid_outfile(m_strPidFilePath.
Get());
500 if (pid_outfile.is_open()) {
501 pid_outfile << the_pid;
506 otErr <<
"Failed trying to open data locking file (to store "
507 "PID " << the_pid <<
"): " << m_strPidFilePath <<
"\n";
508 m_bIsPidOpen =
false;
OTLOG_IMPORT OTLogStream otWarn
EXPORT const char * Get() const
OTLOG_IMPORT OTLogStream otErr
The documentation for this class was generated from the following file: