Merge branch 'master' of github.com:elasticsearch/elasticsearch-js into 1.5
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
language: node_js
|
||||
node_js: "0.10"
|
||||
secure: "NDDRc3eclg/sc3sc6bJq7WX0VuSQeQTg8OwgyCXHi5Cg9wyLLXe3ajzx4glLvsqq8uIl+dRE5HpJ5lEyrTMdxWHspUrVbfjRp4JuujoMbdsLjMzOeZZxuYHMGLbJnCWvN0lxNcosiXKydLEaOxgD79sCEJF549TtiHPMXeTl2z8="
|
||||
env:
|
||||
- ES_BRANCH=master COVERAGE=1
|
||||
- ES_BRANCH=1.0 NODE_UNIT=0
|
||||
|
||||
@ -41,20 +41,7 @@ function HttpConnector(host, config) {
|
||||
maxSockets: 11
|
||||
});
|
||||
|
||||
var Agent = this.hand.Agent; // the class
|
||||
if (config.forever) {
|
||||
config.keepAlive = config.forever;
|
||||
}
|
||||
|
||||
if (config.keepAlive) {
|
||||
Agent = this.host.protocol === 'https' ? ForeverAgent.SSL : ForeverAgent;
|
||||
this.on('status set', this.bound.onStatusSet);
|
||||
}
|
||||
|
||||
this.agent = new Agent({
|
||||
maxSockets: config.maxSockets,
|
||||
minSockets: config.minSockets
|
||||
});
|
||||
this.agent = this.createAgent(config);
|
||||
}
|
||||
_.inherits(HttpConnector, ConnectionAbstract);
|
||||
|
||||
@ -81,6 +68,28 @@ HttpConnector.prototype.onStatusSet = _.handler(function (status) {
|
||||
}
|
||||
});
|
||||
|
||||
HttpConnector.prototype.createAgent = function (config) {
|
||||
var Agent = this.hand.Agent; // the class
|
||||
|
||||
if (config.forever) {
|
||||
config.keepAlive = config.forever;
|
||||
}
|
||||
|
||||
if (config.keepAlive) {
|
||||
Agent = this.host.protocol === 'https' ? ForeverAgent.SSL : ForeverAgent;
|
||||
this.on('status set', this.bound.onStatusSet);
|
||||
}
|
||||
|
||||
return new Agent(this.makeAgentConfig(config));
|
||||
};
|
||||
|
||||
HttpConnector.prototype.makeAgentConfig = function (config) {
|
||||
return {
|
||||
maxSockets: config.maxSockets,
|
||||
minSockets: config.minSockets
|
||||
};
|
||||
};
|
||||
|
||||
HttpConnector.prototype.makeReqParams = function (params) {
|
||||
params = params || {};
|
||||
var host = this.host;
|
||||
|
||||
Reference in New Issue
Block a user