提交 9554aa46 编写于 作者: J Johannes Rieken

run alternative machine id experiment, #16151

上级 fb70b84f
......@@ -8,6 +8,37 @@ import * as crypto from 'crypto';
import { TPromise } from 'vs/base/common/winjs.base';
import * as errors from 'vs/base/common/errors';
import * as uuid from 'vs/base/common/uuid';
import { networkInterfaces } from 'os';
const mac = new class {
private _value: string;
get value(): string {
if (this._value === void 0) {
this._initValue();
}
return this._value;
}
private _initValue(): void {
this._value = null;
const interfaces = networkInterfaces();
for (let key in interfaces) {
for (const i of interfaces[key]) {
if (!i.internal) {
this._value = crypto.createHash('sha256').update(i.mac, 'utf8').digest('hex');
return;
}
}
}
}
};
export function _futureMachineIdExperiment(): string {
return mac.value;
}
export function getMachineId(): TPromise<string> {
return new TPromise<string>(resolve => {
......
......@@ -9,7 +9,7 @@ import { TPromise } from 'vs/base/common/winjs.base';
import * as errors from 'vs/base/common/errors';
import * as uuid from 'vs/base/common/uuid';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { getMachineId } from 'vs/base/node/id';
import { getMachineId, _futureMachineIdExperiment } from 'vs/base/node/id';
import { resolveCommonProperties } from '../node/commonProperties';
const SQM_KEY: string = '\\Software\\Microsoft\\SQMClient';
......@@ -32,6 +32,7 @@ export function resolveWorkbenchCommonProperties(storageService: IStorageService
const promises: TPromise<any>[] = [];
promises.push(getOrCreateInstanceId(storageService).then(value => result['common.instanceId'] = value));
promises.push(getOrCreateMachineId(storageService).then(value => result['common.machineId'] = value));
result['common.machineIdExperiment'] = _futureMachineIdExperiment();
if (process.platform === 'win32') {
promises.push(getSqmUserId(storageService).then(value => result['common.sqm.userid'] = value));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册