diff options
author | James Crayne <jim.crayne@gmail.com> | 2017-10-31 21:25:45 +0000 |
---|---|---|
committer | James Crayne <jim.crayne@gmail.com> | 2017-10-31 21:25:45 +0000 |
commit | 4b39ca7d2c7d1592fd5109b9208539ae88fce093 (patch) | |
tree | ef92ce67b16f52ecc2eea28859a4dc620457c780 | |
parent | 4f707645d5a47f2f88ffcbd926a7dd5f18ec8591 (diff) |
ncAllSessions
-rw-r--r-- | src/Network/Tox/Crypto/Handlers.hs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Network/Tox/Crypto/Handlers.hs b/src/Network/Tox/Crypto/Handlers.hs index e1a44930..95ba7217 100644 --- a/src/Network/Tox/Crypto/Handlers.hs +++ b/src/Network/Tox/Crypto/Handlers.hs | |||
@@ -42,6 +42,9 @@ data NetCryptoSession = NCrypto { ncState :: TVar NetCryptoSessionStatus | |||
42 | , ncSockAddr :: SockAddr | 42 | , ncSockAddr :: SockAddr |
43 | , ncHooks :: TVar (Map.Map MessageType [NetCryptoHook]) | 43 | , ncHooks :: TVar (Map.Map MessageType [NetCryptoHook]) |
44 | , ncUnrecognizedHook :: TVar (MessageType -> NetCryptoHook) | 44 | , ncUnrecognizedHook :: TVar (MessageType -> NetCryptoHook) |
45 | , ncAllSessions :: NetCryptoSessions -- ^ may be needed if one net-crypto session | ||
46 | -- needs to possibly start another, as is | ||
47 | -- the case in group chats | ||
45 | } | 48 | } |
46 | 49 | ||
47 | data NetCryptoSessions = NCSessions { netCryptoSessions :: TVar (Map.Map SockAddr NetCryptoSession) | 50 | data NetCryptoSessions = NCSessions { netCryptoSessions :: TVar (Map.Map SockAddr NetCryptoSession) |
@@ -145,6 +148,7 @@ cryptoNetHandler sessions addr (NetHandshake (Handshake (Cookie n24 ecookie) non | |||
145 | , ncSockAddr = addr | 148 | , ncSockAddr = addr |
146 | , ncHooks = ncHooks0 | 149 | , ncHooks = ncHooks0 |
147 | , ncUnrecognizedHook = ncUnrecognizedHook0 | 150 | , ncUnrecognizedHook = ncUnrecognizedHook0 |
151 | , ncAllSessions = sessions | ||
148 | } | 152 | } |
149 | atomically $ modifyTVar allsessions (Map.insert addr netCryptoSession) | 153 | atomically $ modifyTVar allsessions (Map.insert addr netCryptoSession) |
150 | return Nothing | 154 | return Nothing |