summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorJames Crayne <jim.crayne@gmail.com>2018-05-28 19:54:59 +0000
committerJames Crayne <jim.crayne@gmail.com>2018-05-28 19:54:59 +0000
commit8fe574a8f1f2f71b68c89aeacccd05d084a4003d (patch)
treedc665a9b6cc2928f63630f8401af3573338ec7a9 /examples
parent714f05030737b1df78a67ba694ab33fd605d55ed (diff)
ncLastNMsgs is now CyclicBuffer type
Diffstat (limited to 'examples')
-rw-r--r--examples/dhtd.hs10
1 files changed, 4 insertions, 6 deletions
diff --git a/examples/dhtd.hs b/examples/dhtd.hs
index 4b79b132..ce1e1b16 100644
--- a/examples/dhtd.hs
+++ b/examples/dhtd.hs
@@ -108,6 +108,7 @@ import Connection
108import ToxToXMPP 108import ToxToXMPP
109import qualified Connection.Tcp as Tcp (ConnectionEvent(..)) 109import qualified Connection.Tcp as Tcp (ConnectionEvent(..))
110import Control.Concurrent.Supply 110import Control.Concurrent.Supply
111import qualified Data.CyclicBuffer as CB
111 112
112 113
113showReport :: [(String,String)] -> String 114showReport :: [(String,String)] -> String
@@ -708,14 +709,11 @@ clientSession s@Session{..} sock cnum h = do
708 { ncSessionId = id 709 { ncSessionId = id
709 , ncMyPublicKey = yourkey 710 , ncMyPublicKey = yourkey
710 , ncTheirPublicKey = theirkey 711 , ncTheirPublicKey = theirkey
711 , ncLastNMsgs = msgQ 712 , ncLastNMsgs = lastN
712 , ncSockAddr = sockAddr 713 , ncSockAddr = sockAddr
713 , ncMsgNumVar = msgNumVar
714 , ncDropCntVar = dropCntVar
715 }) = do 714 }) = do
716 num <- atomically (readTVar msgNumVar) 715 (num,dropped) <- atomically $ liftA2 (,) (CB.getTotal lastN) (CB.getDropped lastN)
717 dropped <- atomically (readTVar dropCntVar) 716 as <- atomically (CB.cyclicBufferViewList lastN)
718 as <- atomically (packetQueueViewList msgQ)
719 let (h,u) = partition (fst . snd) as 717 let (h,u) = partition (fst . snd) as
720 countHandled = length h 718 countHandled = length h
721 countUnhandled = length u 719 countUnhandled = length u