Skip to content

Commit

Permalink
fix(recorder): cyber_recorder bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
minhanghuang committed Dec 28, 2024
1 parent 194049b commit 527f9c2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions cyber/tools/cyber_recorder/recorder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,16 @@ bool Recorder::InitReadersImpl() {
}

// listen new writers in future
change_conn_ = channel_manager->AddChangeListener(
std::bind(&Recorder::TopologyCallback, this, std::placeholders::_1));
// must use async callback, otherwise deadlock may be occurred.
auto topology_callback =
[this](const apollo::cyber::proto::ChangeMsg& change_msg) {
apollo::cyber::Async(
[this, change_msg] { this->TopologyCallback(change_msg); });
};
change_conn_ = channel_manager->AddChangeListener(topology_callback);
// change_conn_ = channel_manager->AddChangeListener(
// std::bind(&Recorder::TopologyCallback, this, std::placeholders::_1));

if (!change_conn_.IsConnected()) {
AERROR << "change connection is not connected";
return false;
Expand Down

0 comments on commit 527f9c2

Please sign in to comment.