mirror of
https://github.com/openstf/stf
synced 2025-10-05 02:29:26 +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) {
|
||||
var proxy = proxies[fd]
|
||||
|
||||
if (!proxy) {
|
||||
// New connection
|
||||
proxy = proxies[fd] = new Proxy(fd)
|
||||
}
|
||||
if (packet) {
|
||||
if (!proxy) {
|
||||
// New connection
|
||||
proxy = proxies[fd] = new Proxy(fd)
|
||||
}
|
||||
|
||||
proxy.dest.write(packet)
|
||||
})
|
||||
.on('fin', function(fd) {
|
||||
// The connection ended
|
||||
if (proxies[fd]) {
|
||||
proxies[fd].stop()
|
||||
proxy.dest.write(packet)
|
||||
}
|
||||
else {
|
||||
// The connection ended
|
||||
if (proxy) {
|
||||
proxy.stop()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue