Open nschoe opened 8 years ago
So shouldn't it be incremented here?
Need to double check, probably yes. Serials are important when you receive response and signals usually don't get reply
As a side question: is it mandatory that serials start at 1 and increment? Can they be random?
Yes, I think they can be arbitrary. To me it's easier to increment rather than worry about random numbers collisions ( also easier to debug - which one went out before which )
I was scouting through the code and found this: in the functoin
bus.sendSignal()
, thesignalMsg
gets a fieldserial
, like all other DBus messages, but usually, as seen here the serial is incremented.So shouldn't it be incremented here? I do see that for the signal, as it doesn't expect a return, it doesn't store a callback handler with the serial being the key, but I'm wondering if this can still cause some problems with the daemon: suppose I send a DBus signal with serial 1089, the DBus dameon sees an incoming message to transmit to interested peers, with
serial = 1089
, what if I then send another message (not a signal), maybe a method call, it will haveserial = 1089
too, is it a problem?As a side question: is it mandatory that serials start at 1 and increment? Can they be random? In which case, maybe we could use a library like
shortid
or equivalent that generates a random serial each time, this ways we would not have to think about incrementing it.