1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-05 02:29:26 +02:00

Reset forwards on ungroup.

This commit is contained in:
Simo Kinnunen 2014-10-14 16:07:15 +09:00
parent 04d261044c
commit 44987cbc8b

View file

@ -15,7 +15,8 @@ module.exports = syrup.serial()
.dependency(require('../support/router'))
.dependency(require('../support/push'))
.dependency(require('../resources/minirev'))
.define(function(options, adb, router, push, minirev) {
.dependency(require('./group'))
.define(function(options, adb, router, push, minirev, group) {
var log = logger.createLogger('device:plugins:forward')
var plugin = Object.create(null)
@ -99,6 +100,12 @@ module.exports = syrup.serial()
forwards[port].end()
}
}
this.removeAll = function() {
Object.keys(forwards).forEach(function(port) {
forwards[port].end()
})
}
}
var manager = new ForwardManager()
@ -187,6 +194,12 @@ module.exports = syrup.serial()
})
}
plugin.reset = function() {
manager.removeAll()
}
group.on('leave', plugin.reset)
return startService()
.then(awaitServer)
.then(function() {