Sessionless signals on start

asked 2015-01-23 03:16:51 -0700

eguiho gravatar image

As far as I understand the sessionless signals :

  • A sessionless signal is valid during his TTL
  • When a member comes after the signal sent, if it is interested by the signal, his signal handler is called (if the TTL was not obsolete)

But during my tests, something looks strange. Here is my use case :

  • a first Member (M1) is connected to the bus
  • M1 emits a sessionless signal (without TTL)
  • a second Member (M2) arrives on the bus
    • if M2 registers his signal handler as soon as possible (just after the connection on the bus) => M2 receives the signal emitted by M1
    • if M2 registers his signal handler later (on an user action for example) => M2 never receives the emitted signal by M1 (but receive all the signals that will be emitted after the registration)

Is that the expected behavior ?


edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted

answered 2015-02-04 13:58:39 -0700

updated 2015-02-05 08:23:38 -0700

AddMatch tells the router to send signals to the leaf (the BusAttachment). If there is no signal handler in place in your leaf when the signal arrives then you won't see it.

The sequence to use to ensure you get all available signals is to: 1. Register all you signal handlers, then 2. Add the match rule(s).

edit flag offensive delete publish link more


Just to be sure, I've tried your recommandation, but as I thought it's not the solution. And this solution is not "logical". The AddMatch sets a DBUS flag to allow the sessionless signals reception, I shouldn't have to set it each time I want to register a new signal handler.

eguiho ( 2015-02-05 00:53:33 -0700 )edit

Edited my answer to hopefully address your questions above.

tmalsbar ( 2015-02-05 08:23:56 -0700 )edit

So if I understand correctly, it is not possible to make signals registration and unregistration on user action for example ? Did I have to register all my signals simultaneously in my initialization sequence (just before a AddMatch) ?

eguiho ( 2015-02-05 08:37:36 -0700 )edit

I'm not convinced. And my current sequence works for signals registered immediately after AddMatch (the order does not seem to matter). It's only for signals that are registered later for which I didn't have the initial notification (if signal is emitted again after the registration, I receive it)

eguiho ( 2015-02-05 08:42:41 -0700 )edit

"It's only for signals that are registered later for which I didn't have the initial notification (if signal is emitted again after the registration, I receive it)": this is exactly the sequencing problem. You are calling AddMatch("sessionless='t'") which will start the router getting every sessionless signal on the network. Let's say it gets signals A, B and C. Then later you register a signal handler for C, but it's too late, C was already delivered to your BusAttachment and no handler was in place. Now the emitter sends another C and you will get it since both your match rule and signal handler are in place.

tmalsbar ( 2015-02-05 08:53:03 -0700 )edit

answered 2015-01-26 12:53:05 -0700

Nikhil Dabhade gravatar image

Hi eguiho,

Your understanding is correct. If M1 sent a sessionless signal and M2 registers a signal handler at a later time he should still be able to receive the signal.

Can you verify the following things: 1. You have done an AddMatch rule with sessionless="t" 2. Do you also register the object after the sessionless signal has been sent ? 3. Can you post the sequence of calls on M2 like register object, add match, register signal handler and connection to bus ?


edit flag offensive delete publish link more

answered 2015-01-27 00:36:02 -0700

eguiho gravatar image

Hi, Here are my answers :

  1. Yes, i have done the AddMatch rule with sessionless="t". (I received all the signals as soon as I'm register)
  2. Yes. M1 sent the signal when M2 was not on the Bus. Then M2 arrived on the bus, registers his object, and later registers his signal handler
  3. my sequence below

// in my main class
m_Bus = new BusAttachment(APP_NAME, true); 
m_myObj = createMyBusObject(m_Bus);

// in my bus object constructor
m_iface = m_bus->GetInterface(INTERFACE_NAME);
AddInterface(*m_iface, ANNOUNCED); 

// back in my main class after my bus object creation
// on user action

// in subscribeToSignals method of my object
m_bus.RegisterSignalHandler(  this, static_cast<MessageReceiver::SignalHandler>(&MyObject::onSignals), m_iface->GetMember(SIGNAL_NAME)),  NULL);

And if I do the subscribeToSignals in my bus object constructor (after the RegisterBusObject), it works. But it's not what I expect. I would like to receive the signal of M1 during the registration of my Signal handler, even if it's later

edit flag offensive delete publish link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2015-01-23 03:16:51 -0700

Seen: 220 times

Last updated: Feb 05 '15