| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Just move "free" listener into "init()" method. |
Sorry, something went wrong.
There was a problem hiding this comment.
The changes to use this instead of self, let/const instead of var, etc. don't look related to making Agent subclassable, nor are they justified from a performance standpoint. Besides the unrelated changes, the factoring-out of init() also looks ad-hoc to the specific usage of DestroyAgent, though I'll defer to the judgement of @nodejs/http on this.
Sorry, something went wrong.
|
@TimothyGu revert all replacement. |
Sorry, something went wrong.
|
https://github.com/request/tunnel-agent/blob/master/index.js#L47 Now TunnelingAgent can inherits from http.Agent more easily. function TunnelingAgent extends http.Agent {
constructor(options = {}) {
super(options);
this.proxyOptions = this.options.proxy || {}
this.maxSockets = this.options.maxSockets || http.Agent.defaultMaxSockets
}
init() {
this.on('free', function onFree(socket, host, port) {
// override the free socket listen
});
}
// others methods
addRequest() {}
} |
Sorry, something went wrong.
|
ping @nodejs/http |
Sorry, something went wrong.
Sorry, something went wrong.
|
@lpinca I don't think so, #11567 relaxed the constraint of extended agents, this PR makes the initialization part of the agents customizable via the init() method. Although the ongoing #13005 also tries to make HTTP agents more overridable as well. This needs a rebase before anyone familiar with this part of the codebase can give a review...@fengmk2 |
Sorry, something went wrong.
|
@joyeecheung :) I fixed the conflicts and push again. Anyone can review now! |
Sorry, something went wrong.
Make userland's Agent inherit from http.Agent more easily.
|
PTAL @nodejs/collaborators @nodejs/http |
Sorry, something went wrong.
|
oy! completely missed this one, sorry @fengmk2 |
Sorry, something went wrong.
|
This likely needs a doc update. Code looks fine on first read through, needs a CI |
Sorry, something went wrong.
Sorry, something went wrong.
|
@jasnell The ci is still running for a long time. |
Sorry, something went wrong.
|
the ci completed, the results just are not posting appropriately back to Github. |
Sorry, something went wrong.
There was a problem hiding this comment.
Can you please explain why you need sidestep the internal 'free' event handler? That part is critical for the logic of http.Agent. What is your use case? Maybe we are missing another event or method.
I am -1 with this change.
Sorry, something went wrong.
|
@fengmk2 do you still want to pursue this? |
Sorry, something went wrong.
|
I am closing this due to long inactivity. @fengmk2 if you would like to pursue this, please reopen. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Make userland's Agent inherit from http.Agent more easily.
Checklist
Affected core subsystem(s)