Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

Commit

Permalink
Fix broken app reference in closure.
Browse files Browse the repository at this point in the history
  • Loading branch information
mojit0 committed Aug 23, 2012
1 parent 4ba2715 commit 9b77578
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/mojito.js
Expand Up @@ -520,7 +520,7 @@ MojitoServer.prototype.getWebPage = function(url, opts, cb) {
* and the URL's content.
*/
MojitoServer.prototype.getWebPages = function(urls, cb) {
var app = this,
var server = this,
callback,
count,
len,
Expand All @@ -542,7 +542,7 @@ MojitoServer.prototype.getWebPages = function(urls, cb) {
// the list. When the list is empty we can stop.
initOne = function() {
if (count < len) {
app.getWebPage(urls[count], function(err, url, data) {
server.getWebPage(urls[count], function(err, url, data) {
count += 1;
try {
callback(err, url, data);
Expand Down Expand Up @@ -603,6 +603,7 @@ MojitoServer.prototype.setLogWriter = function(writer) {
MojitoServer.prototype.start = function(cb) {

var logger,
app = this._app,
callback = cb || Mojito.NOOP;

if (this._options.verbose) {
Expand All @@ -619,7 +620,7 @@ MojitoServer.prototype.start = function(cb) {
this._app.listen(this._options.port, null, function(err) {
// NOTE that we're passing the private app instance here!!!
// TODO: Verify we want to do this, as opposed to passing 'this'.
callback(err, this._app);
callback(err, app);
});
} catch (err) {
callback(err);
Expand Down

0 comments on commit 9b77578

Please sign in to comment.