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?