fix(core): update
This commit is contained in:
parent
8410e09a4d
commit
cb80e4dc2e
@ -100,9 +100,10 @@ export class Universe {
|
||||
(() => {
|
||||
// TODO: properly add the connection
|
||||
const universeConnection = new UniverseConnection({
|
||||
authenticationRequest:
|
||||
socketConnection: socketConnectionArg,
|
||||
authenticationRequests: []
|
||||
})
|
||||
this.universeConnectionManager.addConnection();
|
||||
this.universeConnectionManager.addConnection(universeConnection);
|
||||
})();
|
||||
}
|
||||
});
|
||||
|
@ -29,6 +29,7 @@ export class UniverseConnection {
|
||||
socketConnection: plugins.smartsocket.SocketConnection;
|
||||
authenticationRequests
|
||||
}) {
|
||||
this.socketConnection,
|
||||
// TODO: check if this is correct
|
||||
this.socketConnection.socket.disconnect();
|
||||
}
|
||||
}
|
||||
|
@ -10,20 +10,39 @@ export class UniverseConnectionManager {
|
||||
public async addConnection(universeConnectionArg: UniverseConnection) {
|
||||
let universeConnection = universeConnectionArg;
|
||||
universeConnection = await this.deduplicateUniverseConnection(universeConnection);
|
||||
universeConnection = this.authenticateAuthenticationRequests();
|
||||
universeConnection = await this.authenticateAuthenticationRequests(universeConnection);
|
||||
}
|
||||
|
||||
/**
|
||||
* deduplicates UniverseConnections
|
||||
*/
|
||||
public deduplicateUniverseConnection (universeConnectionArg: UniverseConnection): Promise<UniverseConnection> {
|
||||
public async deduplicateUniverseConnection (universeConnectionArg: UniverseConnection): Promise<UniverseConnection> {
|
||||
let connectionToReturn: UniverseConnection;
|
||||
this.connectionMap.forEach(async existingConnection => {
|
||||
if (existingConnection.socketConnection = universeConnectionArg.socketConnection) {
|
||||
connectionToReturn = await this.mergeUniverseConnections(existingConnection, universeConnectionArg);
|
||||
}
|
||||
});
|
||||
if (!connectionToReturn) {
|
||||
connectionToReturn = universeConnectionArg;
|
||||
}
|
||||
return connectionToReturn;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* authenticate AuthenticationRequests
|
||||
*/
|
||||
public authenticateAuthenticationRequests(universeConnectionArg) {
|
||||
public authenticateAuthenticationRequests(universeConnectionArg): Promise<UniverseConnection> {
|
||||
// TODO: authenticate connections
|
||||
return universeConnectionArg;
|
||||
}
|
||||
|
||||
/**
|
||||
* merges two UniverseConnections
|
||||
*/
|
||||
public mergeUniverseConnections (connectionArg1: UniverseConnection, connectionArg2: UniverseConnection) {
|
||||
// TODO: merge connections
|
||||
return connectionArg1;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user