diff options
Diffstat (limited to 'src/Network/Tox/Crypto')
-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 |