Bug in ServerRepository?

Hi again,

In the same vein as my last post, I believe that I have hit a small off-by-one error in ServerRepository.

Specifically I am looking at this line in handleClientUpdateField:

doidbase = (doid / self.DOIDrange) * self.DOIDrange

The intent of the line appears to be to find the base DOID of the client that owns the object being updated. self.DOIDrange, being the number of DOIDs allocated to each client, is integrally divided into the DOID in question then multiplied back out, to find what would be the first DOID in that range (the ‘base’).

The problem is that DOIDs are allocated starting from 1, not from 0. Assuming the default DOIDrange of 1000000, the base DOID for the first client would be 1, the second 1000001, the third 2000001, etc. However the equation above comes up with 0, 1000000, 2000000, etc., so it can’t find the objects.

The fix of course is simple, assuming I am understanding the problem:

doidbase = (doid / self.DOIDrange) * self.DOIDrange + 1

This change has been working for me, though again I am still fuzzy on some of the inner workings so it is possible I am missing some subtle detail. Thoughts?

Thanks,

  • lem