diff options
author | Joey Hess <joey@kitenet.net> | 2012-09-11 15:06:29 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-09-11 15:09:00 -0400 |
commit | 2c1ceeeaf9a1cad8477e86e8c73c7f7a2de510ab (patch) | |
tree | 294a8fc2eda701d0936c77d3f27ac3448780ca24 /Assistant/Threads | |
parent | aace44454a8866e8dab251c2b9c98e2d48e3f071 (diff) |
pairing works!!
Finally.
Last bug fixes here: Send PairResp with same UUID in the PairReq.
Fix off-by-one in code that filters out our own pairing messages.
Also reworked the pairing alerts, which are still slightly buggy.
Diffstat (limited to 'Assistant/Threads')
-rw-r--r-- | Assistant/Threads/PairListener.hs | 26 |
1 files changed, 3 insertions, 23 deletions
diff --git a/Assistant/Threads/PairListener.hs b/Assistant/Threads/PairListener.hs index d4f8a07c8..14d189dd2 100644 --- a/Assistant/Threads/PairListener.hs +++ b/Assistant/Threads/PairListener.hs @@ -17,7 +17,6 @@ import Assistant.DaemonStatus import Assistant.WebApp import Assistant.WebApp.Types import Assistant.Alert -import Utility.Tense import Network.Multicast import Network.Socket @@ -40,7 +39,7 @@ pairListenerThread st dstatus scanremotes urlrenderer = thread $ withSocketsDo $ sane <- checkSane msg (pip, verified) <- verificationCheck m =<< (pairingInProgress <$> getDaemonStatus dstatus) - let wrongstage = maybe False (\p -> pairMsgStage m < inProgressPairStage p) pip + let wrongstage = maybe False (\p -> pairMsgStage m <= inProgressPairStage p) pip case (wrongstage, sane, pairMsgStage m) of -- ignore our own messages, and -- out of order messages @@ -107,32 +106,13 @@ pairReqReceived True _ _ _ = noop -- ignore our own PairReq pairReqReceived False dstatus urlrenderer msg = do url <- renderUrl urlrenderer (FinishPairR msg) [] void $ addAlert dstatus $ pairRequestReceivedAlert repo - (repo ++ " is sending a pair request.") $ AlertButton { buttonUrl = url , buttonLabel = T.pack "Respond" - , buttonAction = Just onclick + , buttonAction = Nothing } where - pairdata = pairMsgData msg - repo = concat - [ remoteUserName pairdata - , "@" - , fromMaybe (showAddr $ pairMsgAddr msg) - (remoteHostName pairdata) - , ":" - , (remoteDirectory pairdata) - ] - {- Remove the button when it's clicked, and change the - - alert to be in progress. This alert cannot be entirely - - removed since more pair request messages are coming in - - and would re-add it. -} - onclick i = updateAlert dstatus i $ \alert -> Just $ alert - { alertButton = Nothing - , alertClass = Activity - , alertIcon = Just ActivityIcon - , alertData = [UnTensed $ T.pack $ "pair request with " ++ repo ++ " in progress"] - } + repo = pairRepo msg {- When a verified PairAck is seen, a host is ready to pair with us, and has - already configured our ssh key. Stop sending PairReqs, finish the pairing, |