Skip to content

Commit

Permalink
[C++] Add semantic version checks to sample tools. Issue #624.
Browse files Browse the repository at this point in the history
  • Loading branch information
mjpt777 committed Jun 6, 2019
1 parent a3932eb commit e1d8e36
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
9 changes: 6 additions & 3 deletions aeron-samples/src/main/cpp/AeronStat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,13 @@ int main (int argc, char** argv)

const std::int32_t cncVersion = CncFileDescriptor::cncVersionVolatile(cncFile);

if (cncVersion != CncFileDescriptor::CNC_VERSION)
if (semanticVersionMajor(cncVersion) != semanticVersionMajor(CncFileDescriptor::CNC_VERSION))
{
std::cerr << "CNC version not supported: file version=" << cncVersion << std::endl;
return -1;
std::cerr << "CNC version not supported: "
<< " file=" << semanticVersionToString(cncVersion)
<< " app=" << semanticVersionToString(CncFileDescriptor::CNC_VERSION) << std::endl;

return EXIT_FAILURE;
}

const std::int64_t clientLivenessTimeoutNs = CncFileDescriptor::clientLivenessTimeout(cncFile);
Expand Down
7 changes: 5 additions & 2 deletions aeron-samples/src/main/cpp/DriverTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,12 @@ int main (int argc, char** argv)

const std::int32_t cncVersion = CncFileDescriptor::cncVersionVolatile(cncFile);

if (cncVersion != CncFileDescriptor::CNC_VERSION)
if (semanticVersionMajor(cncVersion) != semanticVersionMajor(CncFileDescriptor::CNC_VERSION))
{
std::cerr << "CNC version not supported: file version=" << cncVersion << std::endl;
std::cerr << "CNC version not supported: "
<< " file=" << semanticVersionToString(cncVersion)
<< " app=" << semanticVersionToString(CncFileDescriptor::CNC_VERSION) << std::endl;

return EXIT_FAILURE;
}

Expand Down
9 changes: 6 additions & 3 deletions aeron-samples/src/main/cpp/ErrorStat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,13 @@ int main (int argc, char** argv)

const std::int32_t cncVersion = CncFileDescriptor::cncVersionVolatile(cncFile);

if (cncVersion != CncFileDescriptor::CNC_VERSION)
if (semanticVersionMajor(cncVersion) != semanticVersionMajor(CncFileDescriptor::CNC_VERSION))
{
std::cerr << "CNC version not supported: file version=" << cncVersion << std::endl;
return -1;
std::cerr << "CNC version not supported: "
<< " file=" << semanticVersionToString(cncVersion)
<< " app=" << semanticVersionToString(CncFileDescriptor::CNC_VERSION) << std::endl;

return EXIT_FAILURE;
}

AtomicBuffer errorBuffer = CncFileDescriptor::createErrorLogBuffer(cncFile);
Expand Down

0 comments on commit e1d8e36

Please # to comment.