|
@@ -32,14 +32,15 @@ export class ServerClientManager {
|
|
let initialReport: ConnectionState
|
|
let initialReport: ConnectionState
|
|
let reportSubject: BehaviorSubject<ConnectionState>
|
|
let reportSubject: BehaviorSubject<ConnectionState>
|
|
let retransmission: BufferService
|
|
let retransmission: BufferService
|
|
|
|
+ let errorString: string
|
|
// let originalRequest = JSON.parse(JSON.stringify(request))
|
|
// let originalRequest = JSON.parse(JSON.stringify(request))
|
|
let originalRequest = _.cloneDeep(request)
|
|
let originalRequest = _.cloneDeep(request)
|
|
let database: string
|
|
let database: string
|
|
let response: any = { message: `Fail to complete connection generation` }
|
|
let response: any = { message: `Fail to complete connection generation` }
|
|
- let statusChain: State = 0
|
|
|
|
|
|
+ let statusChain: State = 1
|
|
let connectionAttribute: ConnectionAttribute
|
|
let connectionAttribute: ConnectionAttribute
|
|
|
|
|
|
- if (statusChain == 0) {
|
|
|
|
|
|
+ if (statusChain == 1) {
|
|
if (!request.server) {
|
|
if (!request.server) {
|
|
request.server = this.defaultServerAttribute
|
|
request.server = this.defaultServerAttribute
|
|
}
|
|
}
|
|
@@ -55,18 +56,17 @@ export class ServerClientManager {
|
|
initialReport = { status: 'BUFFER' }
|
|
initialReport = { status: 'BUFFER' }
|
|
reportSubject = new BehaviorSubject(initialReport)
|
|
reportSubject = new BehaviorSubject(initialReport)
|
|
retransmission = new BufferService(request.server.messageToBePublishedFromApplication, reportSubject, database)
|
|
retransmission = new BufferService(request.server.messageToBePublishedFromApplication, reportSubject, database)
|
|
-
|
|
|
|
- statusChain = 1
|
|
|
|
}
|
|
}
|
|
|
|
|
|
if (statusChain == 1) {
|
|
if (statusChain == 1) {
|
|
// Connection Type checking
|
|
// Connection Type checking
|
|
if (request.server!.connectionType != request.client!.connectionType) {
|
|
if (request.server!.connectionType != request.client!.connectionType) {
|
|
console.log(`Connection Type DOES NOT MATCH!`)
|
|
console.log(`Connection Type DOES NOT MATCH!`)
|
|
- statusChain = 0
|
|
|
|
|
|
+ statusChain = -1
|
|
|
|
+ errorString ="Connection Type DOES NOT MATCH!"
|
|
} else {
|
|
} else {
|
|
statusChain = 1
|
|
statusChain = 1
|
|
- }
|
|
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
if (statusChain == 1) {
|
|
if (statusChain == 1) {
|
|
@@ -102,17 +102,27 @@ export class ServerClientManager {
|
|
if (res == false) {
|
|
if (res == false) {
|
|
this.connectionAttributes.push(connectionAttribute)
|
|
this.connectionAttributes.push(connectionAttribute)
|
|
console.log(`Connection ${connectionAttribute.ConnectionID.local} registered...`)
|
|
console.log(`Connection ${connectionAttribute.ConnectionID.local} registered...`)
|
|
- response = {
|
|
|
|
- message: "Channel Response",
|
|
|
|
- requestedTo: originalRequest,
|
|
|
|
- data: connectionAttribute
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
console.log(`There is now ${this.connectionAttributes.length} connection Attributes`)
|
|
console.log(`There is now ${this.connectionAttributes.length} connection Attributes`)
|
|
})
|
|
})
|
|
statusChain = 1
|
|
statusChain = 1
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (statusChain == 1) {
|
|
|
|
+ response = {
|
|
|
|
+ message: "Channel Response",
|
|
|
|
+ requestedTo: originalRequest,
|
|
|
|
+ data: connectionAttribute!
|
|
|
|
+ }
|
|
|
|
+ resolve(response);
|
|
|
|
+ } else if (statusChain == -1) {
|
|
|
|
+ response = {
|
|
|
|
+ message: "Channel Response Error",
|
|
|
|
+ requestedTo: originalRequest,
|
|
|
|
+ data: errorString! // put error string here
|
|
|
|
+ }
|
|
|
|
+ resolve(response);
|
|
|
|
+ }
|
|
if (statusChain == 1) {
|
|
if (statusChain == 1) {
|
|
// This is default connection`
|
|
// This is default connection`
|
|
if (!request.client!.connectionType) {
|
|
if (!request.client!.connectionType) {
|
|
@@ -123,9 +133,6 @@ export class ServerClientManager {
|
|
// this.grpcService.create(request, connectionAttribute, this.outGoingInfo)
|
|
// this.grpcService.create(request, connectionAttribute, this.outGoingInfo)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- resolve(response);
|
|
|
|
-
|
|
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|