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:
Beat Küng
2016-04-16 10:21:52 +02:00
committed by tumbili
parent 8fa18f412a
commit fdc10d212b
3 changed files with 27 additions and 10 deletions

View File

@@ -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... */