提交 3fe08d6a 编写于 作者: I isidor

debug: introduce id to session.

上级 4311ca49
......@@ -270,12 +270,11 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
}));
this.toDispose.push(this.session.addListener2(debug.SessionEvents.DEBUGEE_TERMINATED, (event: DebugProtocol.TerminatedEvent) => {
if (this.session) {
if (this.session && this.session.getId() === (<any>event).sessionId) {
this.session.disconnect().done(null, errors.onUnexpectedError);
}
}));
this.toDispose.push(this.session.addListener2(debug.SessionEvents.OUTPUT, (event: DebugProtocol.OutputEvent) => {
if (event.body && typeof event.body.output === 'string' && event.body.output.length > 0) {
this.onOutput(event);
......@@ -785,9 +784,9 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService
if (!this.session) {
return Promise.as(null);
}
var enabledExBreakpoints = this.model.getExceptionBreakpoints().filter(exb => exb.enabled);
return this.session.setExceptionBreakpoints({ filters: enabledExBreakpoints.map(exb => exb.name) });
var enabledExBreakpoints = this.model.getExceptionBreakpoints().filter(exb => exb.enabled);
return this.session.setExceptionBreakpoints({ filters: enabledExBreakpoints.map(exb => exb.name) });
}
private onFileChanges(fileChangesEvent: FileChangesEvent): void {
......
......@@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import stream = require('stream');
import uuid = require('vs/base/common/uuid');
import ee = require('vs/base/common/eventEmitter');
import { Promise, TPromise } from 'vs/base/common/winjs.base';
import debug = require('vs/workbench/parts/debug/common/debug');
......@@ -18,6 +19,7 @@ export class V8Protocol extends ee.EventEmitter {
private sequence: number;
private pendingRequests: { [id: number]: (e: DebugProtocol.Response) => void; };
private rawData: Buffer;
private id: string;
private contentLength: number;
constructor() {
......@@ -28,6 +30,7 @@ export class V8Protocol extends ee.EventEmitter {
this.contentLength = -1;
this.pendingRequests = {};
this.rawData = new Buffer(0);
this.id = uuid.generateUuid();
}
public emit(eventType: string, data?: any): void {
......@@ -38,10 +41,15 @@ export class V8Protocol extends ee.EventEmitter {
eventType === debug.SessionEvents.DEBUGEE_TERMINATED || eventType === debug.SessionEvents.SERVER_EXIT) {
this.flowEventsCount++;
}
data.sessionId = this.getId();
super.emit(eventType, data);
}
public getId(): string {
return this.id;
}
protected connect(readable: stream.Readable, writable: stream.Writable): void {
this.outputStream = writable;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册