Properly handle connection timeout on unauthenticated websocket
This commit is contained in:
parent
8cadc40975
commit
d4a30a0165
1 changed files with 13 additions and 1 deletions
|
@ -407,7 +407,17 @@ export class SocketManager extends EventListener {
|
|||
});
|
||||
this.unauthenticated = process;
|
||||
|
||||
const unauthenticated = await this.unauthenticated.getResult();
|
||||
let unauthenticated: WebSocketResource;
|
||||
try {
|
||||
unauthenticated = await this.unauthenticated.getResult();
|
||||
} catch (error) {
|
||||
window.log.info(
|
||||
'SocketManager: failed to connect unauthenticated socket ' +
|
||||
` due to error: ${Errors.toLogFormat(error)}`
|
||||
);
|
||||
this.dropUnauthenticated(process);
|
||||
throw error;
|
||||
}
|
||||
|
||||
window.log.info('SocketManager: connected unauthenticated socket');
|
||||
|
||||
|
@ -540,8 +550,10 @@ export class SocketManager extends EventListener {
|
|||
{
|
||||
abort() {
|
||||
if (resource) {
|
||||
window.log.warn(`SocketManager closing socket ${path}`);
|
||||
resource.close(3000, 'aborted');
|
||||
} else {
|
||||
window.log.warn(`SocketManager aborting connection ${path}`);
|
||||
clearTimeout(timer);
|
||||
client.abort();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue