From 4b39ca7d2c7d1592fd5109b9208539ae88fce093 Mon Sep 17 00:00:00 2001 From: James Crayne Date: Tue, 31 Oct 2017 21:25:45 +0000 Subject: ncAllSessions --- src/Network/Tox/Crypto/Handlers.hs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/Network/Tox/Crypto/Handlers.hs') 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 , ncSockAddr :: SockAddr , ncHooks :: TVar (Map.Map MessageType [NetCryptoHook]) , ncUnrecognizedHook :: TVar (MessageType -> NetCryptoHook) + , ncAllSessions :: NetCryptoSessions -- ^ may be needed if one net-crypto session + -- needs to possibly start another, as is + -- the case in group chats } data NetCryptoSessions = NCSessions { netCryptoSessions :: TVar (Map.Map SockAddr NetCryptoSession) @@ -145,6 +148,7 @@ cryptoNetHandler sessions addr (NetHandshake (Handshake (Cookie n24 ecookie) non , ncSockAddr = addr , ncHooks = ncHooks0 , ncUnrecognizedHook = ncUnrecognizedHook0 + , ncAllSessions = sessions } atomically $ modifyTVar allsessions (Map.insert addr netCryptoSession) return Nothing -- cgit v1.2.3