diff options
author | joe <joe@jerkface.net> | 2018-06-22 07:20:24 -0400 |
---|---|---|
committer | joe <joe@jerkface.net> | 2018-06-22 07:22:33 -0400 |
commit | 40a8f0b6eb66bae93f8708dd84aaec57f7505c05 (patch) | |
tree | e328f56dd88433a00814452e60ead88acfe13f3b /src/Network | |
parent | 6bbc15735f6e28740c0e05fc8219fd83a5a464a4 (diff) |
Forward port to nightly-2018-06-22.
Diffstat (limited to 'src/Network')
-rw-r--r-- | src/Network/BitTorrent/DHT/ContactInfo.hs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Network/BitTorrent/DHT/ContactInfo.hs b/src/Network/BitTorrent/DHT/ContactInfo.hs index dfc93ed7..ed38caf7 100644 --- a/src/Network/BitTorrent/DHT/ContactInfo.hs +++ b/src/Network/BitTorrent/DHT/ContactInfo.hs | |||
@@ -15,6 +15,7 @@ import Data.List as L | |||
15 | import Data.Maybe | 15 | import Data.Maybe |
16 | import Data.HashMap.Strict as HM | 16 | import Data.HashMap.Strict as HM |
17 | import Data.Serialize | 17 | import Data.Serialize |
18 | import Data.Semigroup | ||
18 | import Data.Wrapper.PSQ as PSQ | 19 | import Data.Wrapper.PSQ as PSQ |
19 | import Data.Time.Clock.POSIX | 20 | import Data.Time.Clock.POSIX |
20 | import Data.ByteString (ByteString) | 21 | import Data.ByteString (ByteString) |
@@ -190,6 +191,11 @@ instance Default (PeerStore) where | |||
190 | def = PeerStore HM.empty | 191 | def = PeerStore HM.empty |
191 | {-# INLINE def #-} | 192 | {-# INLINE def #-} |
192 | 193 | ||
194 | instance Semigroup PeerStore where | ||
195 | PeerStore a <> PeerStore b = | ||
196 | PeerStore (HM.unionWith swarmInsert a b) | ||
197 | {-# INLINE (<>) #-} | ||
198 | |||
193 | -- | Monoid under union operation. | 199 | -- | Monoid under union operation. |
194 | instance Monoid PeerStore where | 200 | instance Monoid PeerStore where |
195 | mempty = def | 201 | mempty = def |