rxcomm / pyaxo

A python implementation of the Axolotl ratchet protocol.
GNU General Public License v3.0
71 stars 11 forks source link

Sync methods with a decorator #20

Closed felipedau closed 7 years ago

felipedau commented 7 years ago

While I was making some changes to unMessage, I had to use a Lock for encryption because I removed the queue that synchronized it. I noticed it would be useful to leave it up to pyaxo to sync these methods so that applications would not have to worry about it.

I made a @sync decorator to use the instance's own lock attribute so that we do not even have to move code into with blocks. Do you think that would be useful?

Thanks!