140
141
constructor(protocol: IMessagePassingProtocol, logger: IRPCProtocolLogger | null = null, transformer: IURITransformer | null = null) {
143
>
this._protocol = protocol;
144
>
this._logger = logger;
145
>
this._uriTransformer = transformer;
146
>
this._uriReplacer = createURIReplacer(this._uriTransformer);
147
>
this._isDisposed = false;
148
>
this._locals = [];
149
>
this._proxies = [];
150
>
for (let i = 0, len = ProxyIdentifier.count; i < len; i++) {
151
this._locals[i] = null;
152
this._proxies[i] = null;
153
}
155
>
this._cancelInvokedHandlers = Object.create(null);
156
>
this._pendingRPCReplies = {};
157
>
this._responsiveState = ResponsiveState.Responsive;
158
>
this._unacknowledgedCount = 0;
159
>
this._unresponsiveTime = 0;
160
>
this._asyncCheckUresponsive = this._register(new RunOnceScheduler(() => this._checkUnresponsive(), 1000));
161
>
this._register(this._protocol.onMessage((msg) => this._receiveOneMessage(msg)));
162
>
}
163
164
public override dispose(): void {
166
>
167
>
// Release all outstanding promises with a canceled error
168
>
Object.keys(this._pendingRPCReplies).forEach((msgId) => {
169
const pending = this._pendingRPCReplies[msgId];
170
delete this._pendingRPCReplies[msgId];
171
pending.resolveErr(errors.canceled());
173
>
174
>
super.dispose();
175
>
}
176
177
public drain(): Promise<void> {