nlocks/lock.tcp.js

19 lines
558 B
JavaScript

'use strict'
const NamedPipeLockServer = require('./lock.namedpipe');
class TCPLockServer extends NamedPipeLockServer {
constructor(lockOptions) {
super(lockOptions);
this.port = lockOptions.port || 7301;
this.host = lockOptions.host || '0.0.0.0';
}
_start(){
this.server.listen(this.port, this.host,()=>{
this._logger.debug(`Lock server listening on ${this.host}:${this.port}`);
});
this.server.on('error', (err) => {
this._logger.error(`Lock server error: ${err}`);
});
}
}
module.exports = TCPLockServer;