From b09df3cbdc0e1ee56a4b07e3bd7594bb3ce7fd50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sat, 16 Sep 2023 20:32:36 +0200 Subject: Network: acknowledgment using packet counter --- src/Network.hs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/Network.hs') 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 -- cgit v1.2.3