Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix a bug when playing games on pip boy
The pipboy seems to disconnect while playing games, this causes an EPIPE error.
This commit adds an error handler to client to make tracing easier and handles end and close on the socket.
  • Loading branch information
Nathan Hutchision committed Nov 22, 2015
commit c755bf10ef1f323a949519bc45b132d6a3beac0d
15 changes: 15 additions & 0 deletions lib/relay.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,21 @@ TCPRelay.prototype.listen = function listen (upstreamInfo, cb) {
cb(copiedBuffer, telemetry)
})

client.on('error', function (err) {
console.error(err)
})

client.on('close', function (hadError) {
if (hadError) {
console.error('error on close')
}
fakeClient.close()
})

client.on('end', function () {
fakeClient.end()
})

fakeClient.on('close', function (hadError) {
if (hadError) {
console.error('error on close')
Expand Down