Skip to content

Commit

Permalink
Keep state when stop/starting a browser
Browse files Browse the repository at this point in the history
  • Loading branch information
watson committed Dec 27, 2015
1 parent c5aa5ae commit 01be4be
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ function Browser (mdns, opts, onup) {
this._name = serviceName.stringify(opts.type, opts.protocol || 'tcp') + TLD
this._mdns = mdns
this._onresponse = null
this.services = []
this.start()
}

Browser.prototype.start = function () {
if (this._onresponse) return

var self = this
this.services = []

this._onresponse = function (packet) {
var matches = buildServicesFor(self._name, packet)
Expand All @@ -66,8 +66,6 @@ Browser.prototype.stop = function () {

this._mdns.removeListener('response', this._onresponse)
this._onresponse = null

this.removeAllListeners()
}

Browser.prototype._addService = function (service) {
Expand Down

0 comments on commit 01be4be

Please sign in to comment.