Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Decided to make hostname second parameter to avoid breaking existing
implementations
  • Loading branch information
FrederickGeek8 committed Jul 24, 2017
1 parent 6478f15 commit cfd8e3f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lighthouse-core/gather/connections/cri.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,20 @@ const WebSocket = require('ws');
const http = require('http');
const log = require('lighthouse-logger');

const hostname = 'localhost';
const DEFAULT_HOSTNAME = 'localhost';
const CONNECT_TIMEOUT = 10000;
const DEFAULT_PORT = 9222;

class CriConnection extends Connection {
/**
* @param {number=} port Optional port number. Defaults to 9222;
* @param {string} hostname Optional hostname. Defaults to localhost.
* @constructor
*/
constructor(port) {
constructor(port, hostname) {
super();

this.hostname = hostname || DEFAULT_HOSTNAME;
this.port = port || DEFAULT_PORT;
}

Expand Down Expand Up @@ -77,7 +79,7 @@ class CriConnection extends Connection {
_runJsonCommand(command) {
return new Promise((resolve, reject) => {
const request = http.get({
hostname: hostname,
hostname: this.hostname,
port: this.port,
path: '/json/' + command
}, response => {
Expand Down

0 comments on commit cfd8e3f

Please sign in to comment.