Skip to content

Commit

Permalink
rosbag_storage: Fixed unnecessary writing to map in write only mode #…
Browse files Browse the repository at this point in the history
…1742 (#1798)

Signed-off-by: Ted Kern <ted.kern@canonical.com>
  • Loading branch information
Arnatious authored and dirk-thomas committed Aug 4, 2020
1 parent 304b31f commit 861eafd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tools/rosbag_storage/include/rosbag/bag.h
Original file line number Diff line number Diff line change
Expand Up @@ -563,8 +563,11 @@ void Bag::doWrite(std::string const& topic, ros::Time const& time, T const& msg,

std::multiset<IndexEntry>& chunk_connection_index = curr_chunk_connection_indexes_[connection_info->id];
chunk_connection_index.insert(chunk_connection_index.end(), index_entry);
std::multiset<IndexEntry>& connection_index = connection_indexes_[connection_info->id];
connection_index.insert(connection_index.end(), index_entry);

if (mode_ != BagMode::Write) {
std::multiset<IndexEntry>& connection_index = connection_indexes_[connection_info->id];
connection_index.insert(connection_index.end(), index_entry);
}

// Increment the connection count
curr_chunk_info_.connection_counts[connection_info->id]++;
Expand Down

0 comments on commit 861eafd

Please sign in to comment.