Skip to content
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

RSA4c+d #212

Merged
merged 5 commits into from
Feb 13, 2019
Merged

RSA4c+d #212

merged 5 commits into from
Feb 13, 2019

Conversation

withakay
Copy link
Contributor

Changes and tests to cover RSA4c (1,2,3) and RSA4d

@withakay withakay requested review from paddybyers and funkyboy April 24, 2018 15:26
@withakay withakay changed the base branch from RSA4a+b to feature/RSC7b+RSA4a+RSA4c1+RSA4c3 April 26, 2018 09:15
@withakay withakay changed the base branch from feature/RSC7b+RSA4a+RSA4c1+RSA4c3 to RSA4a+b April 26, 2018 09:15
Copy link

@funkyboy funkyboy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good. See comments.

}
else if (newState.State != Realtime.ConnectionState.Failed)
{
await SetState(new ConnectionFailedState(this, ex.ErrorInfo, Logger));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heads up: some parts of the spec might be reworded and lead to a change of this behavior. At the moment it's just a discussion, so this is fine.

should transition to the FAILED state, with the connection errorReason should be set to
the ErrorInfo (or where there is none, as for a 403 authUrl response with no body, an ErrorInfo with code 40300 and an appropriate message)
*/

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While putting this in code might make it unreadable pretty quickly, I think it's more than ok to put it in the description of the PR. Future us will have a way to know what was the wording of the spec item when it was implemented.

await realtimeClient.WaitForState(ConnectionState.Connected);
realtimeClient.Connection.On(change =>
{
// this callback should not be called
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I am reading this correctly, there should be a fail statement here. No?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cesare the failure is on line 353 (await tca.Task).Should().BeFalse(context);

Copy link
Member

@paddybyers paddybyers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments

@@ -213,9 +213,17 @@ private void SetAuthMethod()
}
catch (Exception ex) when (shouldCatch)
{
HttpStatusCode? statusCode = null;
int code = 80019;
if (ex is AblyException ablyException)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this implements the requirement. The outer error has code 80019 and it wraps the original error as cause. I don't know why this references 40300.

Copy link
Contributor Author

@withakay withakay Aug 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@paddybyers
This is to comply with RSA4d, could you expand on what you think is wrong with this please?

If a request by a realtime client to an authUrl results in an HTTP 403 response, or any of an authUrl request, an authCallback, or a request to Ably to exchange a TokenRequest for a TokenDetails result in an ErrorInfo with statusCode 403, then the client library should transition to the FAILED state, with the connection errorReason should be set to the ErrorInfo (or where there is none, as for a 403 authUrl response with no body, an ErrorInfo with code 40300 and an appropriate message)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where are you getting that text from?

The requirement I'm looking at is in https://github.com/ably/docs/blob/integration-spec-1-1/content/client-lib-development-guide/features.textile

The required check for RSA4d is statusCode == 403, not code == xx. And either way once you have the inner error you generate the ErrorInfo to return with code = 80019, statusCode = <inner err>.statusCode, cause = <inner err>. The difference when RSA4d applies is in the Realtime case you transition to failed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That text is from the from the Google Sheet titled "Ably .NET Realtime Client Library Spec - v1.1"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@withakay withakay changed the base branch from RSA4a+b to v1.0.0-development December 14, 2018 15:48
reconnectAwaiter.SetCompleted();
});
});
await Task.Delay(1000);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a "magic" delay?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are points where some internal events are raised and if I recall it was possible to hit the next line before they had been handled, so this delay allow for that. So yes, somewhat magical.

@paddybyers paddybyers self-requested a review February 11, 2019 23:05
Copy link
Member

@paddybyers paddybyers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants