Skip to content

Commit

Permalink
Merge lepture#51
Browse files Browse the repository at this point in the history
  • Loading branch information
lepture committed Jan 9, 2014
2 parents e0071a9 + 96f529a commit fd134a7
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,16 @@ function createServer(options, callback) {
createWatch(app, fn);
}

if (callback) {
callback(null, app);
} else {
log.info('server', 'http://127.0.0.1:' + options.port);
app.listen(options.port).on('error', function(e) {
if (e.code === 'EADDRINUSE') {
log.error('error', 'this port is in use, change to another one');
} else {
throw e;
}
});
}
log.info('server', 'http://127.0.0.1:' + options.port);
app.listen(options.port).on('error', function(e) {
if (e.code === 'EADDRINUSE') {
log.error('error', 'this port is in use, change to another one');
} else {
throw e;
}
});

callback && callback(null, app);
}

var io;
Expand Down

0 comments on commit fd134a7

Please sign in to comment.