Skip to content
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
4 changes: 2 additions & 2 deletions ts/src/connections/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"buffer": "^5.2.1",
"debug": "^4.1.1",
"vscode-jsonrpc": "^4.0.0",
"@microsoft/dev-tunnels-contracts": ">1.1.6",
"@microsoft/dev-tunnels-management": ">1.1.6",
"@microsoft/dev-tunnels-contracts": ">1.1.8",
"@microsoft/dev-tunnels-management": ">1.1.8",
"@microsoft/dev-tunnels-ssh": "^3.11.36",
"@microsoft/dev-tunnels-ssh-tcp": "^3.11.36",
"uuid": "^3.3.3",
Expand Down
2 changes: 1 addition & 1 deletion ts/src/management/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"buffer": "^5.2.1",
"debug": "^4.1.1",
"vscode-jsonrpc": "^4.0.0",
"@microsoft/dev-tunnels-contracts": ">1.1.6",
"@microsoft/dev-tunnels-contracts": ">1.1.8",
"axios": "^1.6.2"
}
}
16 changes: 10 additions & 6 deletions ts/src/management/tunnelManagementHttpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -780,12 +780,12 @@ export class TunnelManagementHttpClient implements TunnelManagementClient {

if (error.code === 'ECONNABORTED') {
// server timeout
errorMessage = 'Timeout waiting for server response.';
errorMessage = `Timeout reached: ${error.message}`;
}

if (error.message === 'Network Error' && signal.aborted) {
if (signal.aborted) {
// connection timeout
errorMessage = 'Timeout connecting to server.'
errorMessage = `Signal aborted: ${error.message}`
}

if (error.response?.data) {
Expand Down Expand Up @@ -1090,13 +1090,14 @@ export class TunnelManagementHttpClient implements TunnelManagementClient {

let disposable: Disposable | undefined;
const abortController = new AbortController();
let timeout: NodeJS.Timeout | undefined = undefined;
const newAbortSignal = () => {
if (cancellation?.isCancellationRequested) {
abortController.abort();
abortController.abort('Cancelled: CancellationToken cancel requested.');
} else if (cancellation) {
disposable = cancellation.onCancellationRequested(() => abortController.abort());
disposable = cancellation.onCancellationRequested(() => abortController.abort('Cancelled: CancellationToken cancel requested.'));
} else {
setTimeout(() => abortController.abort(), defaultRequestTimeoutMS);
timeout = setTimeout(() => abortController.abort('Cancelled: default request timeout reached.'), defaultRequestTimeoutMS);
}
return abortController.signal;
}
Expand Down Expand Up @@ -1136,6 +1137,9 @@ export class TunnelManagementHttpClient implements TunnelManagementClient {

throw requestError;
} finally {
if (timeout) {
clearTimeout(timeout);
}
disposable?.dispose();
}
}
Expand Down
4 changes: 2 additions & 2 deletions ts/test/tunnels-test/tunnelManagementTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export class TunnelManagementTests {
error = <Error>e;
}

assert(error?.message?.includes('Timeout waiting for server response.'));
assert(error?.message?.includes('Timeout reached: '));
}

@test
Expand All @@ -159,7 +159,7 @@ export class TunnelManagementTests {
error = <Error>e;
}

assert(error?.message?.includes('Timeout connecting to server.'));
assert(error?.message?.includes('Signal aborted: '));
}

@test
Expand Down