This PR continues the work on #63 (and should be merged after that one).
Description
Given the following sequence diagram for sending a Message:
If a message is sent by the user, right an instant before a connection refresh start, the message will be delivered by Meta after receiving our PUBLISH (/ls_req) (1) packet.
However the connection refresh could be closing the socket before Meta's PUBACK (2), or the PUBLISH(/ls_resp) (3) are received by us.
In that scenario, the makeLSRequest will be locked until the timeout defined in ResponseHandler.waitForDetails is triggered.
This PR changes that behavior by exposing the Context used by Client, so that whenever that Context is cancelled (by calling stopCurrentConnection), we also notify ResponseHandler.waitForDetails.
This PR also changes the signature for: waitForPubACKDetails, waitForSubACKDetails, and waitForPubResponseDetails so that they return a different sentinel error depending on each scenario.
TO BE DISCUSSED:
We need to discuss how to handle the new ErrContextCancelled in Portal.handleMatrixMessage. With the current implementation in this PR, the sent message will still be flagged as "Not delivered" in Beeper, despite having been delivered properly.
Context
This PR continues the work on #63 (and should be merged after that one).
Description
Given the following sequence diagram for sending a Message:
If a message is sent by the user, right an instant before a connection refresh start, the message will be delivered by Meta after receiving our
PUBLISH (/ls_req)
(1) packet.However the connection refresh could be closing the socket before Meta's
PUBACK
(2), or thePUBLISH(/ls_resp)
(3) are received by us.In that scenario, the
makeLSRequest
will be locked until the timeout defined inResponseHandler.waitForDetails
is triggered.This PR changes that behavior by exposing the
Context
used byClient
, so that whenever that Context is cancelled (by callingstopCurrentConnection
), we also notifyResponseHandler.waitForDetails
.This PR also changes the signature for:
waitForPubACKDetails
,waitForSubACKDetails
, andwaitForPubResponseDetails
so that they return a different sentinel error depending on each scenario.TO BE DISCUSSED:
We need to discuss how to handle the new
ErrContextCancelled
inPortal.handleMatrixMessage
. With the current implementation in this PR, the sent message will still be flagged as "Not delivered" in Beeper, despite having been delivered properly.