summaryrefslogtreecommitdiff
path: root/src/Network.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2023-09-16 20:32:36 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2023-09-16 21:43:43 +0200
commitb09df3cbdc0e1ee56a4b07e3bd7594bb3ce7fd50 (patch)
tree8cad16b9ea9c91688b38b3dd18b73b1ac97dabdf /src/Network.hs
parentcbdffb714cf24eacfe08586f56109e46df234806 (diff)
Network: acknowledgment using packet counter
Diffstat (limited to 'src/Network.hs')
-rw-r--r--src/Network.hs5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/Network.hs b/src/Network.hs
index 8cb2ed5..1d28d68 100644
--- a/src/Network.hs
+++ b/src/Network.hs
@@ -451,7 +451,8 @@ handlePacket identity secure peer chanSvc svcs (TransportHeader headers) prefs =
DataResponse dgst -> if
| Just pref <- find ((==dgst) . refDigest) prefs -> do
- addHeader $ Acknowledged dgst
+ when (not secure) $ do
+ addHeader $ Acknowledged dgst
liftSTM $ writeTQueue (serverDataResponse server) (peer, Just pref)
| otherwise -> throwError $ "mismatched data response " ++ show dgst
@@ -470,7 +471,6 @@ handlePacket identity secure peer chanSvc svcs (TransportHeader headers) prefs =
readTVarP (peerIdentityVar peer) >>= \case
PeerIdentityFull _ -> do
void $ newWaitingRef dgst $ handleIdentityUpdate peer
- addHeader $ Acknowledged dgst
_ -> return ()
TrChannelRequest dgst -> do
@@ -513,7 +513,6 @@ handlePacket identity secure peer chanSvc svcs (TransportHeader headers) prefs =
| svc `elem` svcs -> do
if dgst `elem` map refDigest prefs || True {- TODO: used by Message service to confirm receive -}
then do
- addHeader $ Acknowledged dgst
void $ newWaitingRef dgst $ \ref ->
liftIO $ atomically $ writeTQueue chanSvc (peer, svc, ref)
else throwError $ "missing service object " ++ show dgst