when running the many requests tests on node, we get stuck only on the part of "connect" and until we get to the part where we write the connection times out.
Right now even if the socket is nonblocking, we block until we get a response.
The solution would probably be to move the part of creating a local socket and listening on it to be before we even send the request, then not block for answer for connect when socket is nonblocking. One issue is that we need to set the local address that comes from the remote - we can do it when the connection is actually made since I assume none will call getsockname before it succeeds.
Another part of the solution would be to make the agent connect as part of the socket handling socket, so it itself wont block until the connect is done.
when running the many requests tests on node, we get stuck only on the part of "connect" and until we get to the part where we write the connection times out. Right now even if the socket is nonblocking, we block until we get a response. The solution would probably be to move the part of creating a local socket and listening on it to be before we even send the request, then not block for answer for connect when socket is nonblocking. One issue is that we need to set the local address that comes from the remote - we can do it when the connection is actually made since I assume none will call
getsockname
before it succeeds. Another part of the solution would be to make the agent connect as part of the socket handling socket, so it itself wont block until the connect is done.