Giter VIP home page Giter VIP logo

Comments (11)

fengmk2 avatar fengmk2 commented on August 23, 2024

finished module:

module.exports = function (thingie, callback) {
  var socket = thingie.socket || thingie
  var res = thingie.res || thingie
  if (!socket.writable)
    return setImmediate(callback)

  socket.on('error', done)
  socket.on('close', done)
  res.on('finish', done)

  function done(err) {
    socket.removeListener('error', done)
    socket.removeListener('close', done)
    res.removeListener('finish', done)
    callback(err)
  }

  return thingie
}

from onerror.

fengmk2 avatar fengmk2 commented on August 23, 2024

https://github.com/joyent/node/blob/master/lib/net.js#L461

var isException = exception ? true : false;
    this._handle.close(function() {
      debug('emit close');
      self.emit('close', isException);
    });

from onerror.

dead-horse avatar dead-horse commented on August 23, 2024

err in callback(err) is false, not instance of Error?

from onerror.

fengmk2 avatar fengmk2 commented on August 23, 2024

when socket close event emit, err is a Boolean

from onerror.

dead-horse avatar dead-horse commented on August 23, 2024

hmmm. ping @jonathanong

from onerror.

dead-horse avatar dead-horse commented on August 23, 2024

i think it should fixed in finished

from onerror.

fengmk2 avatar fengmk2 commented on August 23, 2024

thingie.socket is ctx.socket, but why we need to listen error and close event?

from onerror.

jonathanong avatar jonathanong commented on August 23, 2024

Already fixed this in latest finished

from onerror.

fengmk2 avatar fengmk2 commented on August 23, 2024

same as jshttp/on-finished#1

close by jshttp/on-finished@8b2baaa

from onerror.

fengmk2 avatar fengmk2 commented on August 23, 2024

@jonathanong Also need to update koa deps: finished: '~1.1.3'

from onerror.

jonathanong avatar jonathanong commented on August 23, 2024

is that really necessary? semver can do the work

from onerror.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.