-
-
Notifications
You must be signed in to change notification settings - Fork 91
agent: better handling errors during connection handshake retries #1578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
9039b6a to
833be46
Compare
56ed24f to
6eb362e
Compare
| (Right agentMsgBody, CR.SMDNoChange) -> | ||
| case skipped of | ||
| CR.SMDNoChange -> pure () | ||
| _ -> logWarn "conf: skipped confirmations" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This allows retries confirmations that result in skipped messages
| let pqInitKeys = CR.joinContactInitialKeys (v >= pqdrSMPAgentVersion) pqSup | ||
| (CCLink cReq _, service) <- case conn of | ||
| NewConnection _ -> newRcvConnSrv c userId connId enableNtfs SCMInvitation Nothing Nothing pqInitKeys subMode srv | ||
| RcvConnection _ rq -> mkJoinInvitation rq pqInitKeys |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This allows repeat joins to contact address when the queue is created but the error happens when sending invitation
| NewConnection _ -> doJoin Nothing Nothing | ||
| SndConnection _ sq -> doJoin Nothing (Just sq) | ||
| DuplexConnection _ (rq@RcvQueue {status = New} :| _) (sq@SndQueue {status = sqStatus} :| _) | ||
| | sqStatus == New || sqStatus == Secured -> doJoin (Just rq) (Just sq) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This allows retries after initiator's queue is secured
| mkAgentConfirmation c cData rq_ sq srv connInfo subMode = do | ||
| (qInfo, service) <- case rq_ of | ||
| Nothing -> createReplyQueue c cData sq subMode srv | ||
| Just rq@RcvQueue {smpClientVersion = v, clientService} -> pure (SMPQueueInfo v $ rcvSMPQueueAddress rq, dbServiceId <$> clientService) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This allows retries after queue is created, but the confirmation failed to sent.
| logInfo . decodeUtf8 $ "Agent connected to " <> showServer srv <> " (user " <> bshow userId <> maybe "" (" for entity " <>) entityId_ <> ")" | ||
| atomically $ putTMVar (sessionVar v) (Right client) | ||
| atomically $ writeTBQueue (subQ c) ("", "", AEvt SAENone $ hostEvent CONNECT client) | ||
| liftIO $ nonBlockingWriteTBQueue (subQ c) ("", "", AEvt SAENone $ hostEvent CONNECT client) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may be hanging in the test because the queue is small, but in theory can reach capacity in the app too if there are too many events.
No description provided.