diff options
author | Joe Crayne <joe@jerkface.net> | 2020-01-25 17:13:58 -0500 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2020-01-25 19:18:13 -0500 |
commit | c0b6b785596df15d3bf48cd5aba171a5d1bccd23 (patch) | |
tree | 906ef7073be2b261e5f6e72037c455067fd1482f /dht/src/Network/Tox/Session.hs | |
parent | d4c209fb9543019461bcf612da67708aeabcdce2 (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.hs | 5 |
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 | ||
99 | sTheirDHTKey :: Session -> PublicKey | ||
100 | sTheirDHTKey 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. |
99 | sClose :: Session -> IO () | 104 | sClose :: Session -> IO () |
100 | sClose s = do | 105 | sClose s = do |