Skip to content

Instantly share code, notes, and snippets.

@alessioalex
Forked from ricardobeat/node-0.8.20-hangup.js
Created March 14, 2013 14:05
Show Gist options
  • Save alessioalex/5161583 to your computer and use it in GitHub Desktop.
Save alessioalex/5161583 to your computer and use it in GitHub Desktop.
function hangups (req, res, next){
var reqd = domain.create()
reqd.add(req)
reqd.add(res)
reqd.on('error', function (error) {
if (error.code !== 'ECONNRESET') console.error(error, req.url)
reqd.dispose()
})
next()
}
app.use(hangups)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment