summaryrefslogtreecommitdiff
path: root/dht/src/Network/Tox/Session.hs
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2020-01-25 17:13:58 -0500
committerJoe Crayne <joe@jerkface.net>2020-01-25 19:18:13 -0500
commitc0b6b785596df15d3bf48cd5aba171a5d1bccd23 (patch)
tree906ef7073be2b261e5f6e72037c455067fd1482f /dht/src/Network/Tox/Session.hs
parentd4c209fb9543019461bcf612da67708aeabcdce2 (diff)
Only one session at a time (per DHT node).
Diffstat (limited to 'dht/src/Network/Tox/Session.hs')
-rw-r--r--dht/src/Network/Tox/Session.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/dht/src/Network/Tox/Session.hs b/dht/src/Network/Tox/Session.hs
index 53d63287..1b1c62c4 100644
--- a/dht/src/Network/Tox/Session.hs
+++ b/dht/src/Network/Tox/Session.hs
@@ -6,6 +6,7 @@ module Network.Tox.Session
6 , SessionKey 6 , SessionKey
7 , Session(..) 7 , Session(..)
8 , sTheirUserKey 8 , sTheirUserKey
9 , sTheirDHTKey
9 , sClose 10 , sClose
10 , handshakeH 11 , handshakeH
11 ) where 12 ) where
@@ -95,6 +96,10 @@ sTheirUserKey s = longTermKey $ runIdentity cookie
95 where 96 where
96 Cookie _ cookie = handshakeCookie (sReceivedHandshake s) 97 Cookie _ cookie = handshakeCookie (sReceivedHandshake s)
97 98
99sTheirDHTKey :: Session -> PublicKey
100sTheirDHTKey s = case handshakeCookie $ sReceivedHandshake s of
101 Cookie _ (Identity cd) -> dhtKey cd
102
98-- | Helper to close the 'Transport' associated with a session. 103-- | Helper to close the 'Transport' associated with a session.
99sClose :: Session -> IO () 104sClose :: Session -> IO ()
100sClose s = do 105sClose s = do