diff --git a/lib/net/tcp.js b/lib/net/tcp.js index 5be58b7..d778de3 100644 --- a/lib/net/tcp.js +++ b/lib/net/tcp.js @@ -220,19 +220,28 @@ function resolveDnsSeed(seed) { } TcpTransport.prototype.bootstrap = function() { - var promises = this.dnsSeeds.map(resolveDnsSeed); var hardcodedNodes = this.seeds; // FIXME(Kagami): Filter incorrect/private IP range nodes? // See also: . - return PPromise.all(promises).then(function(dnsNodes) { - // Flatten array of arrays. - dnsNodes = Array.prototype.concat.apply([], dnsNodes); + return this.bootstrapDns().then(function(dnsNodes) { // Add hardcoded nodes to the end of list because DNS nodes should // be more up-to-date. return dnsNodes.concat(hardcodedNodes); }); }; +/** + * Do only DNS-specific bootstrap. + * @return {Promise.} Discovered seed nodes. + */ +TcpTransport.prototype.bootstrapDns = function() { + var promises = this.dnsSeeds.map(resolveDnsSeed); + return PPromise.all(promises).then(function(dnsNodes) { + // Flatten array of arrays. + return Array.prototype.concat.apply([], dnsNodes); + }); +}; + /** * Connect to a TCP node. Connection arguments are the same as for * [net.connect](http://nodejs.org/api/net.html#net_net_connect_port_host_connectlistener).