TimelordUK / jspurefix

native typescript FIX engine
MIT License
58 stars 27 forks source link

Misplaced check of acceptor/initiator config #28

Closed rcluan closed 2 years ago

rcluan commented 2 years ago

Hi there. It seems to me that the check of the acceptor/initiafor config file are misplaced during setup:

private async setup () {
    this.sessionContainer.registerGlobal()
    const server = this.initiatorConfig ? this.makeServer() : this.empty() // should be this.acceptorConfig
    const client = this.acceptorConfig ? this.makeClient() : this.empty() // should be this.initiatorConfig
    this.logger.info('launching ....')
    return Promise.all([server, client])
}

makeClient() and makeServer() are using the correct files though:

private async makeClient (): Promise<any> {
    const description: ISessionDescription = require(path.join(this.root, this.initiatorConfig))
    const sessionContainer = await this.makeSystem(description)
    this.register(sessionContainer)
    this.logger.info('create initiator')
    return this.getInitiator(sessionContainer)
}
private async makeServer (): Promise<any> {
    const description: ISessionDescription = require(path.join(this.root, this.acceptorConfig))
    const sessionContainer = await this.makeSystem(description)
    this.register(sessionContainer)
    this.logger.info('create acceptor')
    return this.getAcceptor(sessionContainer)
}