mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-28 09:50:35 +08:00
orb: fix when orb_subscribe_multi is called before orb_advertise_multi
This fixes the previously introduced unit test. It fixes the case where orb_subscribe_multi is called multiple times with different instances, and no publisher advertised the topic yet. In this case all subscribers got the same instance 0.
This commit is contained in:
@@ -273,6 +273,9 @@ int uORB::Manager::node_open
|
||||
|
||||
/* open the path as either the advertiser or the subscriber */
|
||||
fd = px4_open(path, advertiser ? PX4_F_WRONLY : PX4_F_RDONLY);
|
||||
|
||||
} else {
|
||||
*instance = 0;
|
||||
}
|
||||
|
||||
/* we may need to advertise the node... */
|
||||
|
||||
Reference in New Issue
Block a user