Reduce flag checking.

This commit is contained in:
John-David Dalton
2014-05-02 19:37:48 -07:00
parent 7dcb56ea5c
commit 9e4cc7fdbc

View File

@@ -306,7 +306,7 @@ function onJobStart(error, res, body) {
tunnel = this.tunnel; tunnel = this.tunnel;
this.starting = false; this.starting = false;
if (this.stopping || tunnel.starting || tunnel.stopping) { if (this.stopping || tunnel.starting) {
return; return;
} }
if (error || !id || statusCode != 200) { if (error || !id || statusCode != 200) {
@@ -354,7 +354,7 @@ function onJobStatus(error, res, body) {
url = data.url; url = data.url;
this.checking = false; this.checking = false;
if (this.starting || this.stopping || tunnel.starting || tunnel.stopping) { if (!this.running || this.stopping) {
return; return;
} }
this.emit('status', jobStatus); this.emit('status', jobStatus);
@@ -514,6 +514,7 @@ Job.prototype.stop = function(callback) {
} }
this.stopping = true; this.stopping = true;
if (this.statusId) { if (this.statusId) {
this.checking = false;
this.statusId = clearTimeout(this.statusId); this.statusId = clearTimeout(this.statusId);
} }
if (this.id == null || !this.running) { if (this.id == null || !this.running) {