keep track of the stage we're at in pairing

This avoids us responding to our own pairing messages, as well
as ignoring any out of order messages that might be received somehow.
This commit is contained in:
Joey Hess 2012-09-11 12:58:00 -04:00
parent 16d27e9c02
commit aace44454a
4 changed files with 29 additions and 22 deletions

View file

@ -26,7 +26,7 @@ data PairStage
| PairAck
{- "I saw your PairAck; you can stop sending them." -}
| PairDone
deriving (Eq, Read, Show)
deriving (Eq, Read, Show, Ord)
newtype PairMsg = PairMsg (Verifiable (PairStage, PairData, SomeAddr))
deriving (Eq, Read, Show)
@ -66,6 +66,7 @@ data PairingInProgress = PairingInProgress
, inProgressThreadId :: Maybe ThreadId
, inProgressSshKeyPair :: SshKeyPair
, inProgressPairData :: PairData
, inProgressPairStage :: PairStage
}
data SomeAddr = IPv4Addr HostAddress | IPv6Addr HostAddress6