diff options
author | Joey Hess <joeyh@joeyh.name> | 2017-04-30 13:54:02 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2017-04-30 13:54:02 -0400 |
commit | b47e621749257331788e82e44d1565cf4d32d04b (patch) | |
tree | d6c3445be85b05fc58675552fc1bfb4f0ceb375d /Types.hs | |
parent | 89d4e18cdb6ed1c3e7916dd66cf907bedf58a549 (diff) | |
download | debug-me-b47e621749257331788e82e44d1565cf4d32d04b.tar.gz |
fix probable race in use of restoreHashes
I think there was a race where a SessionKey message had been drained
from the TChan, but not yet added to the developer state, which was
resonsible for recent instability at startup.
It manifested as protocol errors where the prevActivity hash was wrongly
Nothing.
Fixed by adding a MissingHashes type to tag things whose hashes have
been stripped, and adding back the hashes when needed, which always
happens inside atomically blocks, so won't have such a race.
Diffstat (limited to 'Types.hs')
-rw-r--r-- | Types.hs | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -64,6 +64,10 @@ data Activity a = Activity } deriving (Show, Generic) +-- | Used when a value has had its hashes erased for more efficient +-- transfer over the wire. +data MissingHashes a = MissingHashes a + instance DataSize a => DataSize (Activity a) where dataSize a = dataSize (activity a) + maybe 0 dataSize (prevActivity a) |