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

Update OS to get the reconnect fix #1407

Merged
merged 2 commits into from
May 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

### Bug fixes
- Fix a crash when querying over properties that have `[MapTo]` applied. ([#1405](https://github.com/realm/realm-dotnet/pull/1405))
- Fix an issue where synchronized Realms did not connect to the remote server in certain situations, such as when an application was offline when the Realms were opened but later regained network connectivity. ([#1407](https://github.com/realm/realm-dotnet/pull/1407))

### Breaking Changes
- The constructors of `PermissionChange`, `PermissionOffer`, and `PermissionOfferResponse` are now private. Use the new `User.ApplyPermissions`, `User.OfferPermissions`, and `User.AcceptPermissionOffer` API. (#1361)
Expand Down
8 changes: 6 additions & 2 deletions Realm/Realm.Sync/Helpers/AuthenticationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ internal static class AuthenticationHelper
private const int ErrorContentTruncationLimit = 256 * 1024;
private static readonly string AppId = string.Empty; // FIXME
private static readonly Lazy<HttpClient> _client = new Lazy<HttpClient>(() => new HttpClient { Timeout = TimeSpan.FromSeconds(30) });

private static readonly ConcurrentDictionary<string, Timer> _tokenRefreshTimers = new ConcurrentDictionary<string, Timer>();
private static readonly DateTimeOffset _date_1970 = new DateTimeOffset(1970, 1, 1, 0, 0, 0, TimeSpan.Zero);
private static readonly MediaTypeHeaderValue _applicationJsonUtf8MediaType = MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
Expand Down Expand Up @@ -75,7 +75,11 @@ public static async Task RefreshAccessToken(Session session, bool reportErrors =
var accessToken = result["access_token"];

session.Handle.RefreshAccessToken(accessToken["token"].Value<string>(), accessToken["token_data"]["path"].Value<string>());
ScheduleTokenRefresh(user.Identity, session.Path, _date_1970.AddSeconds(accessToken["token_data"]["expires"].Value<long>()));
if (session.State != SessionState.Invalid)
{
Session.Reconnect();
ScheduleTokenRefresh(user.Identity, session.Path, _date_1970.AddSeconds(accessToken["token_data"]["expires"].Value<long>()));
}
}
catch (HttpException ex) when (_connectivityStatusCodes.Contains(ex.StatusCode))
{
Expand Down
4 changes: 2 additions & 2 deletions wrappers/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

# Dependencies

CORE_VER=2.6.2
SYNC_VER=1.8.2
CORE_VER=2.7.0
SYNC_VER=1.9.0

REALM_ENABLE_SYNC ?= 1

Expand Down