remove unnecessary mvar
authorJoey Hess <joeyh@joeyh.name>
Fri, 30 Sep 2016 17:17:49 +0000 (13:17 -0400)
committerJoey Hess <joeyh@joeyh.name>
Fri, 30 Sep 2016 17:17:49 +0000 (13:17 -0400)
Remote/External.hs
Remote/External/Types.hs

index 13c46585b8e8a8ac3cb13c785500a740d5b6d77c..b10977b6d1ce9ce118cf12ddb641bebab72e55e9 100644 (file)
@@ -242,13 +242,13 @@ handleRequest' lck external req mp responsehandler
                send $ VALUE value
        handleRemoteRequest (SETCREDS setting login password) = do
                c <- liftIO $ atomically $ readTMVar $ externalConfig external
-               gc <- liftIO $ atomically $ readTMVar $ externalGitConfig external
+               let gc = externalGitConfig external
                c' <- setRemoteCredPair encryptionAlreadySetup c gc (credstorage setting) $
                        Just (login, password)
                void $ liftIO $ atomically $ swapTMVar (externalConfig external) c'
        handleRemoteRequest (GETCREDS setting) = do
                c <- liftIO $ atomically $ readTMVar $ externalConfig external
-               gc <- liftIO $ atomically $ readTMVar $ externalGitConfig external
+               let gc = externalGitConfig external
                creds <- fromMaybe ("", "") <$> 
                        getRemoteCredPair c gc (credstorage setting)
                send $ CREDS (fst creds) (snd creds)
index 87c2dc056c539b1c7eb721f4f7da16adea115f04..be608d4e5797770bcd5f5a194e6e7d82bf552466 100644 (file)
@@ -54,8 +54,7 @@ data External = External
        , externalLock :: TMVar ExternalLock
        -- Never left empty.
        , externalConfig :: TMVar RemoteConfig
-       -- Never left empty.
-       , externalGitConfig :: TMVar RemoteGitConfig
+       , externalGitConfig :: RemoteGitConfig
        }
 
 newExternal :: ExternalType -> UUID -> RemoteConfig -> RemoteGitConfig -> Annex External
@@ -65,7 +64,7 @@ newExternal externaltype u c gc = liftIO $ External
        <*> atomically newEmptyTMVar
        <*> atomically (newTMVar ExternalLock)
        <*> atomically (newTMVar c)
-       <*> atomically (newTMVar gc)
+       <*> pure gc
 
 type ExternalType = String