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

Commit

Permalink
default to flush interval of -1 (which means behaviour is exactly as …
Browse files Browse the repository at this point in the history
…it was without a flush interval before)
  • Loading branch information
Consti10 committed Dec 19, 2020
1 parent 1f3d360 commit ce3b56e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/rx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,13 +403,13 @@ radio_loop(std::shared_ptr<Aggregator> agg,const std::vector<std::string> rxInte

if (rc == 0){
// timeout expired
// smaller than 0 means no flush enabled
if(flush_interval.count()>0){
// smaller than 0 means no flush enabled
// else we didn't receive data for FLUSH_INTERVAL ms
agg->flushRxRing();
}
continue;
}

for (int i = 0; rc > 0 && i < N_RECEIVERS; i++) {
if (fds[i].revents & (POLLERR | POLLNVAL)) {
throw std::runtime_error("socket error!");
Expand Down
2 changes: 2 additions & 0 deletions src/tx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ void WBTransmitter::loop() {
}
firstTime=false;
}
// we set the timeout earlier when creating the socket
const ssize_t message_length = recvfrom(mInputSocket, buf.data(), MAX_PAYLOAD_SIZE, 0, nullptr, nullptr);
if(std::chrono::steady_clock::now()>=log_ts){
const auto runTimeMs=std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now()-INIT_TIME).count();
Expand All @@ -147,6 +148,7 @@ void WBTransmitter::loop() {
// timeout
if(FLUSH_INTERVAL.count()>0){
// smaller than 0 means no flush enabled
// else we didn't receive data for FLUSH_INTERVAL ms
finishCurrentBlock();
}
continue;
Expand Down

0 comments on commit ce3b56e

Please sign in to comment.