node-modules / agentkeepalive

Support keepalive http agent.
MIT License
579 stars 57 forks source link

Make 1.2.1 compatible with node v0.10.x; #18

Closed lattmann closed 9 years ago

lattmann commented 9 years ago

Caveats

We need this library to work with node 0.10.x, 0.11.x, and 0.12.x in our project.

Sorry if i did not format the code correctly.

fengmk2 commented 9 years ago

@lattmann Nice job!

fengmk2 commented 9 years ago

Should add 0.10.x back to travis-ci

lattmann commented 9 years ago

@fengmk2 Thanks for your feedback. Let me know if I have to change anything to get this pull request accepted. (Have not found a CONTRIBUTING.md in the repo.)

I am sorry about the coverage results... Mainly the if (node10) branches are not covered. If you have suggestion how to improve the coverage, i can make some changes. My ideas:

We will depend on the fork, until this library supports node v0.10-v0.12.

lattmann commented 9 years ago

I am not sure that I can fix the two failing https tests.

I looked at closely why 0.2.4 tag and 0.2.x branch are green.

Here is what we have found:

Code coverage got significantly increased by adding node v0.10 to travis.

I am not planning to make any other changes, unless you ask for it.

fengmk2 commented 9 years ago

@lattmann Thanks again, I need to double check the 0.10 agent codebase. It's need some more time.

lattmann commented 9 years ago

@fengmk2 sounds good, we understand. Thanks. We will use our fork in the meantime.

fengmk2 commented 9 years ago

socket.destroyed on 0.10.x always be undefined....

fengmk2 commented 9 years ago

everything seem fine, I will fix some style and merge this.

:+1:

lattmann commented 9 years ago

Thanks.

fengmk2 commented 9 years ago

release 2.0.0

lattmann commented 9 years ago

Thanks for the fast response and merge.

A few side notes (I am not suggesting anything ...):

Looking into the node source code... and running the tests using a debugger. Sometimes the net.createConnection function returns with a socket sometimes with a CleartextStream object.

The CleartextStream object has a socket property, which has the destroyed property.

Probably we can check this when we create the connection and just put the s.socket in the this.sockets object.

fengmk2 commented 9 years ago

I debug again, s.socket.destroyed still false...

CLIENT socket onClose
s.destroyed: undefined, s.socket.destroyed: false
lattmann commented 9 years ago

Your change fixed the tests, I just left this comment here for future reference. :)