diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/dhtd.hs | 10 |
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 | |||
108 | import ToxToXMPP | 108 | import ToxToXMPP |
109 | import qualified Connection.Tcp as Tcp (ConnectionEvent(..)) | 109 | import qualified Connection.Tcp as Tcp (ConnectionEvent(..)) |
110 | import Control.Concurrent.Supply | 110 | import Control.Concurrent.Supply |
111 | import qualified Data.CyclicBuffer as CB | ||
111 | 112 | ||
112 | 113 | ||
113 | showReport :: [(String,String)] -> String | 114 | showReport :: [(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 |