onCloseOrRemove needs to provide argument to removeSocket #3

Closed
frooble opened this Issue May 24, 2012 · 1 comment

2 participants

@frooble

In TunnelingAgent.prototype.addRequest a function is created

  function onCloseOrRemove(err) {
      self.removeSocket();
      socket.removeListener('free', onFree);
      socket.removeListener('close', onCloseOrRemove);
      socket.removeListener('agentRemove', onCloseOrRemove);
    }

I believe the socket variable from closure needs to be provided as an argument

  function onCloseOrRemove(err) {
      //Provide argument to removeSocket
      self.removeSocket(socket);
      socket.removeListener('free', onFree);
      socket.removeListener('close', onCloseOrRemove);
      socket.removeListener('agentRemove', onCloseOrRemove);
    }
@koichik koichik added a commit that closed this issue May 26, 2012
@koichik Fix possible socket leaks.
Fixes #2.
Fixes #3.
da4c509
@koichik koichik closed this in da4c509 May 26, 2012
@koichik
Owner

@frooble - Thanks, fixed in da4c509.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment