Skip to content

Commit

Permalink
unirec++ - inputInterface - dont send EoF if interface is on initiali…
Browse files Browse the repository at this point in the history
…zed, dont set empty template
  • Loading branch information
SiskaPavel committed Jul 25, 2024
1 parent 085af3d commit a415c3e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions unirec/include/unirec++/outputInterface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ class UnirecOutputInterface {
ur_template_t* m_template = nullptr;
uint8_t m_interfaceID;
bool m_sendEoFonExit;
bool m_isInitialized;
UnirecRecord m_unirecRecord;

friend class Unirec;
Expand Down
7 changes: 5 additions & 2 deletions unirec/unirec++/outputInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ UnirecOutputInterface::UnirecOutputInterface(uint8_t interfaceID)
: m_template(nullptr)
, m_interfaceID(interfaceID)
, m_sendEoFonExit(true)
, m_isInitialized(false)
{
}

UnirecOutputInterface::~UnirecOutputInterface()
{
if (m_sendEoFonExit) {
if (m_sendEoFonExit && m_isInitialized) {
sendEoF();
}

Expand Down Expand Up @@ -88,7 +89,7 @@ void UnirecOutputInterface::setAutoflushTimeout(int timeout)

void UnirecOutputInterface::sendEoF() const
{
char dummy[1] = {0};
char dummy[1] = { 0 };
trap_send(m_interfaceID, dummy, sizeof(dummy));
}

Expand Down Expand Up @@ -116,6 +117,8 @@ void UnirecOutputInterface::changeTemplate(const std::string& templateFields)
"created.");
}
m_unirecRecord = createUnirecRecord();

m_isInitialized = true;
}

UnirecRecord UnirecOutputInterface::createUnirecRecord(size_t maxVariableFieldsSize)
Expand Down

0 comments on commit a415c3e

Please sign in to comment.