Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClientRequest._deferToConnect doesn't wait until connected #27875

Closed
ronag opened this issue May 25, 2019 · 1 comment
Closed

ClientRequest._deferToConnect doesn't wait until connected #27875

ronag opened this issue May 25, 2019 · 1 comment
Labels
http Issues or PRs related to the http subsystem.

Comments

@ronag
Copy link
Member

ronag commented May 25, 2019

This is a bit confusing for me. The comments for ClientRequest._deferToConnect says:

This function is for calls that need to happen once the socket is connected and writable.

However, looking at the code it is enough for the socket to be writable.

  const onSocket = () => {
    if (this.socket.writable) {
      // assert(!this.socket.connecting); This could fail
      callSocketMethod();
    } else {
      this.socket.once('connect', callSocketMethod);
    }
  };

Which does not have to mean that the socket is connected.

As is evident in Socket.connect where writable and connecting is both set to true.

  this.connecting = true;
  this.writable = true;

Is this a potential bug or just confusing description?

@lpinca lpinca added the http Issues or PRs related to the http subsystem. label May 26, 2019
@lpinca
Copy link
Member

lpinca commented Jun 23, 2019

Fixed by #27876.

@lpinca lpinca closed this as completed Jun 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
http Issues or PRs related to the http subsystem.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants