Fixed possible bug: callback called twice

This commit is contained in:
witzig 2017-06-22 18:16:26 +02:00
parent 963aef53b5
commit f73eb026b6
2 changed files with 6 additions and 0 deletions

View file

@ -99,6 +99,9 @@ module.exports = callback => {
});
server.listen(config.postfixbounce.port, config.postfixbounce.host, () => {
if (started) {
return server.close();
}
started = true;
log.info('POSTFIXBOUNCE', 'Server listening on port %s', config.postfixbounce.port);
setImmediate(callback);

View file

@ -147,6 +147,9 @@ module.exports = callback => {
}
let host = hosts[pos++];
server.listen(config.verp.port, host, () => {
if (started) {
return server.close();
}
log.info('VERP', 'Server listening on %s:%s', host || '*', config.verp.port);
setImmediate(startNextHost);
});