mirror of
https://github.com/openstf/stf
synced 2025-10-05 10:39:25 +02:00
Use same event fin packets.
This commit is contained in:
parent
ebafa3770e
commit
035acec372
2 changed files with 13 additions and 11 deletions
|
@ -71,17 +71,19 @@ module.exports = syrup.serial()
|
||||||
.on('packet', function(fd, packet) {
|
.on('packet', function(fd, packet) {
|
||||||
var proxy = proxies[fd]
|
var proxy = proxies[fd]
|
||||||
|
|
||||||
|
if (packet) {
|
||||||
if (!proxy) {
|
if (!proxy) {
|
||||||
// New connection
|
// New connection
|
||||||
proxy = proxies[fd] = new Proxy(fd)
|
proxy = proxies[fd] = new Proxy(fd)
|
||||||
}
|
}
|
||||||
|
|
||||||
proxy.dest.write(packet)
|
proxy.dest.write(packet)
|
||||||
})
|
}
|
||||||
.on('fin', function(fd) {
|
else {
|
||||||
// The connection ended
|
// The connection ended
|
||||||
if (proxies[fd]) {
|
if (proxy) {
|
||||||
proxies[fd].stop()
|
proxy.stop()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ ForwardParser.prototype._transform = function(chunk, encoding, done) {
|
||||||
|
|
||||||
if (this._needLength === 0) {
|
if (this._needLength === 0) {
|
||||||
// This is a fin packet
|
// This is a fin packet
|
||||||
this.emit('fin', this._target)
|
this.emit('packet', this._target, null)
|
||||||
this._needLength = -HEADER_SIZE
|
this._needLength = -HEADER_SIZE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue