From f8ebd0363b39d3cf8e79e4eff9ec4852627a807f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 30 Dec 2021 12:16:22 -0400 Subject: [PATCH] complete the magic wormhole pairin appid transition Started in 2017 in commit 3fe9d99f24f2ae980efa4d5d023d8bbd55db98a8. Starting tomorrow, all versions of git-annex since then will provide an appid, and so it will no longer be necessary to check the date. Sponsored-by: Nicholas Golder-Manning on Patreon --- Command/P2P.hs | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/Command/P2P.hs b/Command/P2P.hs index 5e7c3d3178..ded64e0ab9 100644 --- a/Command/P2P.hs +++ b/Command/P2P.hs @@ -29,7 +29,6 @@ import qualified Utility.MagicWormhole as Wormhole import Control.Concurrent.Async import qualified Data.Text as T -import Data.Time.Clock.POSIX cmd :: Command cmd = command "p2p" SectionSetup @@ -233,30 +232,11 @@ wormholePairing remotename ouraddrs ui = do void $ liftIO $ async $ ui observer producer -- Provide an appid to magic wormhole, to avoid using -- the same channels that other wormhole users use. - -- - -- Since a version of git-annex that did not provide an - -- appid is shipping in Debian 9, and having one side - -- provide an appid while the other does not will make - -- wormhole fail, this is deferred until 2021-12-31. - -- After that point, all git-annex's should have been - -- upgraded to include this code, and they will start - -- providing an appid. - -- - -- This assumes reasonably good client clocks. If the clock - -- is completely wrong, it won't use the appid at that - -- point, and pairing will fail. On 2021-12-31, minor clock - -- skew may also cause transient problems. - -- - -- After 2021-12-31, this can be changed to simply - -- always provide the appid. - now <- liftIO getPOSIXTime - let wormholeparams = if now < 1640950000 - then [] - else Wormhole.appId "git-annex.branchable.com/p2p-setup" + let appid = Wormhole.appId "git-annex.branchable.com/p2p-setup" (sendres, recvres) <- liftIO $ - Wormhole.sendFile sendf observer wormholeparams + Wormhole.sendFile sendf observer appid `concurrently` - Wormhole.receiveFile recvf producer wormholeparams + Wormhole.receiveFile recvf producer appid liftIO $ removeWhenExistsWith R.removeLink (toRawFilePath sendf) if sendres /= True then return SendFailed