-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
Better errors for ResponseHandler and cancel ACK and response waits on disconnect #64
Conversation
@@ -21,7 +21,7 @@ func (c *Client) ExecuteTasks(tasks ...socket.Task) (*table.LSTable, error) { | |||
|
|||
resp, err := c.socket.makeLSRequest(payload, 3) | |||
if err != nil { | |||
return nil, fmt.Errorf("failed to send LS request: %v", err) | |||
return nil, err |
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.
Heads up: this is gonna cause changes in the log files / records for users of the bridge, including Beeper infra. As the error strings will be different now.
case <-time.After(packetTimeout): | ||
p.deleteDetails(packetId, channelType) | ||
// TODO this should probably be an error |
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.
I guess the TODO comment here was right :)
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.
Some minor nitpicks
Co-authored-by: Tulir Asokan <tulir@maunium.net>
Co-authored-by: Tulir Asokan <tulir@maunium.net>
Co-authored-by: Tulir Asokan <tulir@maunium.net>
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.
Looks like this should work now
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.