1

LostAdvertisedName() is never called

asked 2014-04-08 03:00:02 -0800

praetp gravatar image

When I find a remote bus, I am never notified when it disappears. No matter what I seem to do (like calling ReleaseName() the name or CancelAdvertisedName() from the 'server'-side myself), it simply does not work... I was so puzzled by this, I added the LostAdvertisedName() to the basic_client sample myself. Even there it does not work (so I don't think the problem is on my end..) Is this a bug ?

(BTW: NameOwnerChanged() IS called when the remote end disappears..)

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2014-04-08 10:54:40 -0800

georgen gravatar image

updated 2014-04-08 10:55:31 -0800

if you are making modifications to the basic_client sample all you should need to do to get a LostAdvertisedName signal is add the following code to the MyBusListener class:

void LostAdvertisedName(const char* name, TransportMask transport, const char* namePrefix) {
    printf("LostAdvertisedName(name='%s', prefix='%s')\n", name, namePrefix);
}

However, running the code you will see that the LostAdvertisedName is still not called this is simply because the basic_client exits before the routing node has time to send out the LostAdvertisedName signal.

if you are using the basic_client and basic_service samples. You will need to add some code that waits at the end of the basic_client before destroying the BusAttachment. Then run the service and client. When you exit the client you should get a LostAdvertisedName.

Side note:

  • RequestName and ReleaseName only specify local ownership the name can not be found till you do an AdvertiseName
  • AdvertiseName and CancelAdvertiseName is called once you already have local ownership of the name
  • you will not get the FoundAdvertisedName or the LostAdvertisedName signals till you have called the FindAdvertisedName method
  • NameOwnerChanged signal will not be sent for a remote name till you establish a session. The NameOwnerChanged signal is only reliable for locally owned names. You should use the functions/callbacks that specify Advertise or Advertised in the function name for anything that is going between two devices or two applications with routing nodes built into the application.
edit flag offensive delete publish link more

Comments

Thanks for your elaborate answer. It works indeed as you described. However, when I do a FindAdvertisedName() with an empty string, I get all the names in FoundAdvertisedName() but they are not reported in LostAdvertisedName() ...

praetp ( 2014-04-09 02:23:36 -0800 )edit

Also, some of those things you mention in the side note, are not mentioned in the header files...

praetp ( 2014-04-09 02:24:27 -0800 )edit
Login/Signup to Answer

Question Tools

Follow
1 follower

Stats

Asked: 2014-04-08 03:00:02 -0800

Seen: 69 times

Last updated: Apr 08 '14