From 15928d4d5eed6196dbc9489d5140446543d886e2 Mon Sep 17 00:00:00 2001 From: Vlad Sudzilouski Date: Mon, 6 Apr 2020 16:34:16 -0700 Subject: [PATCH 1/2] Close conneciton if server rejects writes while maintaining write conneciton Fix Fluid debugger; --- .../src/replayDocumentDeltaConnection.ts | 3 ++- .../container-loader/src/deltaManager.ts | 5 ++++- .../loader/driver-definitions/src/error.ts | 19 +++++++++++++++++++ packages/loader/driver-utils/src/network.ts | 5 +++-- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/packages/drivers/replay-socket-storage/src/replayDocumentDeltaConnection.ts b/packages/drivers/replay-socket-storage/src/replayDocumentDeltaConnection.ts index dd6095897ce9..8e9d1f40d8bc 100644 --- a/packages/drivers/replay-socket-storage/src/replayDocumentDeltaConnection.ts +++ b/packages/drivers/replay-socket-storage/src/replayDocumentDeltaConnection.ts @@ -20,6 +20,7 @@ import { ISignalMessage, ITokenClaims, IVersion, + ScopeType, } from "@microsoft/fluid-protocol-definitions"; import { debug } from "./debug"; import { ReplayController } from "./replayController"; @@ -230,7 +231,7 @@ export class ReplayDocumentDeltaConnection extends EventEmitter implements IDocu private static readonly claims: ITokenClaims = { documentId: ReplayDocumentId, - scopes: [], + scopes: [ScopeType.DocRead, ScopeType.DocWrite], tenantId: "", user: { id: "", diff --git a/packages/loader/container-loader/src/deltaManager.ts b/packages/loader/container-loader/src/deltaManager.ts index 0786cfa2efb5..129eb4f156c8 100644 --- a/packages/loader/container-loader/src/deltaManager.ts +++ b/packages/loader/container-loader/src/deltaManager.ts @@ -36,7 +36,7 @@ import { MessageType, ScopeType, } from "@microsoft/fluid-protocol-definitions"; -import { createIError, createWriteError, createNetworkError } from "@microsoft/fluid-driver-utils"; +import { createIError, createWriteError, createNetworkError, createFatalError } from "@microsoft/fluid-driver-utils"; import { ContentCache } from "./contentCache"; import { debug } from "./debug"; import { DeltaConnection } from "./deltaConnection"; @@ -812,6 +812,9 @@ export class DeltaManager extends EventEmitter implements IDeltaManager (new WriteError(errorMessage) as IError); - /** * Fatal error class - when the server encountered a fatal error */ @@ -151,3 +149,6 @@ export function createNetworkError( } return new GenericNetworkError(errorMessage, statusCode, canRetry, online); } + +export const createWriteError = (errorMessage: string) => (new WriteError(errorMessage) as IError); +export const createFatalError = (errorMessage: string) => (new FatalError(errorMessage) as IError); From 1c58e45c4b0b4c2b4586bf0239acf239c8b560e7 Mon Sep 17 00:00:00 2001 From: Vlad Sudzilouski Date: Mon, 6 Apr 2020 16:56:13 -0700 Subject: [PATCH 2/2] spaces --- packages/loader/container-loader/src/deltaManager.ts | 2 +- packages/loader/driver-definitions/src/error.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/loader/container-loader/src/deltaManager.ts b/packages/loader/container-loader/src/deltaManager.ts index 129eb4f156c8..79bc1bb5a9f5 100644 --- a/packages/loader/container-loader/src/deltaManager.ts +++ b/packages/loader/container-loader/src/deltaManager.ts @@ -812,7 +812,7 @@ export class DeltaManager extends EventEmitter implements IDeltaManager