summaryrefslogtreecommitdiff
path: root/src/Network
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2018-06-22 07:20:24 -0400
committerjoe <joe@jerkface.net>2018-06-22 07:22:33 -0400
commit40a8f0b6eb66bae93f8708dd84aaec57f7505c05 (patch)
treee328f56dd88433a00814452e60ead88acfe13f3b /src/Network
parent6bbc15735f6e28740c0e05fc8219fd83a5a464a4 (diff)
Forward port to nightly-2018-06-22.
Diffstat (limited to 'src/Network')
-rw-r--r--src/Network/BitTorrent/DHT/ContactInfo.hs6
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
15import Data.Maybe 15import Data.Maybe
16import Data.HashMap.Strict as HM 16import Data.HashMap.Strict as HM
17import Data.Serialize 17import Data.Serialize
18import Data.Semigroup
18import Data.Wrapper.PSQ as PSQ 19import Data.Wrapper.PSQ as PSQ
19import Data.Time.Clock.POSIX 20import Data.Time.Clock.POSIX
20import Data.ByteString (ByteString) 21import 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
194instance 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.
194instance Monoid PeerStore where 200instance Monoid PeerStore where
195 mempty = def 201 mempty = def