summaryrefslogtreecommitdiff
path: root/src/Erebos/Network.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2024-07-26 18:36:18 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2024-07-26 18:36:18 +0200
commit72059751dd9246be903462dff91ab9a4fefef56b (patch)
tree59f9759c765d53e4bad04ed7dec9289be27e617c /src/Erebos/Network.hs
parent32326a87d0bef92e21451ba45a5bcb06a8a28568 (diff)
Network: send channel request even with just received cookie
Diffstat (limited to 'src/Erebos/Network.hs')
-rw-r--r--src/Erebos/Network.hs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/Erebos/Network.hs b/src/Erebos/Network.hs
index 442285a..1e06008 100644
--- a/src/Erebos/Network.hs
+++ b/src/Erebos/Network.hs
@@ -671,12 +671,14 @@ setupChannel identity peer upid = do
[ TrChannelRequest reqref
, AnnounceSelf $ refDigest $ storedRef $ idData identity
]
+ let sendChannelRequest = do
+ sendToPeerPlain peer [ Acknowledged reqref, Rejected reqref ] $
+ TransportPacket (TransportHeader hitems) [storedRef req]
+ setPeerChannel peer $ ChannelOurRequest req
liftIO $ atomically $ do
getPeerChannel peer >>= \case
- ChannelCookieConfirmed -> do
- sendToPeerPlain peer [ Acknowledged reqref, Rejected reqref ] $
- TransportPacket (TransportHeader hitems) [storedRef req]
- setPeerChannel peer $ ChannelOurRequest req
+ ChannelCookieReceived -> sendChannelRequest
+ ChannelCookieConfirmed -> sendChannelRequest
_ -> return ()
handleChannelRequest :: Peer -> UnifiedIdentity -> Ref -> WaitingRefCallback