[Verse-dev] Curve subscription bug fixed

Emil Brink emil at obsession.se
Fri Jan 14 15:59:33 CET 2005


Hello.

I just found a two-stage bug in the reference server's code for
curve subscriptions.

First, unsubscribing from a curve (not a *curve node*, but a
single curve in a such a node) was broken; it had a reversed
comparison on the curve_id. The code used to read:

if(node == NULL || node->curve_count >= curve_id ||
   node->curves[curve_id].name[0] == 0)

This has now been changed into the more correct

if(node == NULL || curve_id >= node->curve_count ||
   node->curves[curve_id].name[0] == 0)

since the curve ID really should be less than the number of curves
to be valid (this is a "negative test", processing is aborted if
the test is true, which is why it reads the other way around).

I fixed this, but my test client still received key set/destroy
commands as I edited a test curve in Connector... So, I dove back
into the code, and found that the handlers for set/destroy in the
server used the *node's* subscriptor list for sending out changes,
rather than the *curve's*.

So, any subscriber to a curve node would learn about all editing,
totally ignoring what curve the editing happened in and if the
client was subscribed or not. This felt incorrect, so I fixed it
too, for both c_key_set and c_key_destroy.

I hope this week ends soon.

Regards,

/Emil


More information about the Verse-dev mailing list