diff options
Diffstat (limited to 'examples/dhtd.hs')
-rw-r--r-- | examples/dhtd.hs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/examples/dhtd.hs b/examples/dhtd.hs index fabf0661..b845f9df 100644 --- a/examples/dhtd.hs +++ b/examples/dhtd.hs | |||
@@ -622,14 +622,17 @@ clientSession s@Session{..} sock cnum h = do | |||
622 | -> cmd0 $ do | 622 | -> cmd0 $ do |
623 | sessions <- concat . Map.elems <$> (atomically $ readTVar (Tox.netCryptoSessionsByKey cryptosessions)) | 623 | sessions <- concat . Map.elems <$> (atomically $ readTVar (Tox.netCryptoSessionsByKey cryptosessions)) |
624 | let sessionsReport = mapM showPerSession sessions | 624 | let sessionsReport = mapM showPerSession sessions |
625 | headers = ["SessionID", "YourKey", "TheirKey", "NextMsg", "Dropped","Handled","Unhandled"] | 625 | headers = ["SessionID", "YourKey", "TheirKey", "NextMsg", "Dropped" {-,"Handled","Unhandled" -} |
626 | ,"Progress" ] | ||
626 | showPerSession (Tox.NCrypto | 627 | showPerSession (Tox.NCrypto |
627 | { ncSessionId = id | 628 | { ncState = progressVar |
629 | , ncSessionId = id | ||
628 | , ncMyPublicKey = yourkey | 630 | , ncMyPublicKey = yourkey |
629 | , ncTheirPublicKey = theirkey | 631 | , ncTheirPublicKey = theirkey |
630 | , ncLastNMsgs = lastN | 632 | , ncLastNMsgs = lastN |
631 | , ncSockAddr = sockAddr | 633 | , ncSockAddr = sockAddr |
632 | }) = do | 634 | }) = do |
635 | progress <- atomically $ readTVar progressVar | ||
633 | (num,dropped) <- atomically $ liftA2 (,) (CB.getTotal lastN) (CB.getDropped lastN) | 636 | (num,dropped) <- atomically $ liftA2 (,) (CB.getTotal lastN) (CB.getDropped lastN) |
634 | as <- atomically (CB.cyclicBufferViewList lastN) | 637 | as <- atomically (CB.cyclicBufferViewList lastN) |
635 | let (h,u) = partition (fst . snd) as | 638 | let (h,u) = partition (fst . snd) as |
@@ -640,8 +643,9 @@ clientSession s@Session{..} sock cnum h = do | |||
640 | , show (Tox.key2id theirkey)-- "TheirKey" | 643 | , show (Tox.key2id theirkey)-- "TheirKey" |
641 | , show num -- "NextMsg" | 644 | , show num -- "NextMsg" |
642 | , show dropped -- "Dropped" | 645 | , show dropped -- "Dropped" |
643 | , show countHandled -- "Handled" | 646 | -- , show countHandled -- "Handled" |
644 | , show countUnhandled -- "Unhandled" | 647 | -- , show countUnhandled -- "Unhandled" |
648 | , show progress | ||
645 | ] | 649 | ] |
646 | if null sessions | 650 | if null sessions |
647 | then hPutClient h "No sessions." | 651 | then hPutClient h "No sessions." |