gloebit / opensim-moneymodule-gloebit

OpenSim addon module integrating with the Gloebit digital currency service
GNU Lesser General Public License v3.0
8 stars 12 forks source link

Colosi.auth on failed balance request #29

Closed colosi closed 8 years ago

colosi commented 8 years ago

Balance requests are funneled through new GetAgentBalance function

colosi commented 8 years ago

I've moved the balance request hack class to the GMM and out of GloebitAPI.user. I'd like you to review this code.

I did not modify the User class to either return to a token map or to have User.Get return new local instances. Now that the temp hack stuff has been removed, we should be able to more easily make the proper fix here.

colosi commented 8 years ago

User class now creates and returns copies. Anything that modifies the user in the s_userMap or stores to the DB, first locks the userLock on that user object.

When a Get call forces creation of a new master user object via a read from the DB or a brand new user, we lock the s_userMap and check that this agentID is still not a key before storing it. Otherwise, we grab the user from the map.

On a User.Init call (which is basically a store this token call), we now make a Get call to populate the master user from the db if necessary, or retrieve the user from the map if already in it. We then retrieve the master user from the map directly, lock the userLock, update the token, and store it back to the db.

There are a number of "TODO" comments with questions which may require some additional action.

bradkittenbrink commented 8 years ago

ok, one minor change to the locking around the copy constructor, but after you fix that it looks ready to merge.

LGTM in advance