Skip to content

Commit 7d98ddf

Browse files
fengjingchao-cnycool
authored andcommitted
fix the problem of deadlock when recording the message
1 parent 33cb2e6 commit 7d98ddf

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

ros/ros_comm/roscpp/src/libros/subscription.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,27 @@ uint32_t Subscription::handleMessage(const SerializedMessage& m, bool ser, bool
680680
}
681681
}
682682

683+
if (name_ == "/rosout" || name_ == "/rosout_agg" || name_ == "/tf")
684+
{
685+
if (link)
686+
{
687+
// measure statistics
688+
statistics_.callback(connection_header, name_, link->getCallerID(),
689+
m, link->getStats().bytes_received_, receipt_time, drops > 0);
690+
// If this link is latched, store off the message so we can immediately
691+
// pass it to new subscribers later
692+
if (link->isLatched())
693+
{
694+
LatchInfo li;
695+
li.connection_header = connection_header;
696+
li.link = link;
697+
li.message = m;
698+
li.receipt_time = receipt_time;
699+
latched_messages_[link] = li;
700+
}
701+
}
702+
}
703+
else
683704
{
684705
boost::mutex::scoped_lock lock(publisher_links_mutex_);
685706
for (V_PublisherLink::iterator it = publisher_links_.begin(); it != publisher_links_.end(); ++it)

0 commit comments

Comments
 (0)