Reconnect on interrupted system call.

However, we have to figure out why does it happen at all.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
Akos Kitta
2019-11-30 15:54:49 +01:00
parent 9efcbcf2ae
commit eb7b3ad683
4 changed files with 76 additions and 47 deletions

View File

@@ -1,40 +1,6 @@
import { JsonRpcServer } from '@theia/core/lib/common/messaging/proxy-factory';
import { Board, Port } from './boards-service';
export interface MonitorError {
readonly connectionId: string;
readonly message: string;
readonly code: number;
readonly config: MonitorConfig;
}
export namespace MonitorError {
export namespace ErrorCodes {
/**
* The frontend has refreshed the browser, for instance.
*/
export const CLIENT_CANCEL = 1;
/**
* When detaching a physical device when the duplex channel is still opened.
*/
export const DEVICE_NOT_CONFIGURED = 2;
/**
* Another serial monitor was opened on this port. For another electron-instance, Java IDE.
*/
export const DEVICE_BUSY = 3;
}
}
export interface MonitorReadEvent {
readonly connectionId: string;
readonly data: string;
}
export const MonitorServiceClient = Symbol('MonitorServiceClient');
export interface MonitorServiceClient {
notifyRead(event: MonitorReadEvent): void;
notifyError(event: MonitorError): void;
}
export const MonitorServicePath = '/services/serial-monitor';
export const MonitorService = Symbol('MonitorService');
export interface MonitorService extends JsonRpcServer<MonitorServiceClient> {
@@ -69,3 +35,40 @@ export namespace MonitorConfig {
}
export const MonitorServiceClient = Symbol('MonitorServiceClient');
export interface MonitorServiceClient {
notifyRead(event: MonitorReadEvent): void;
notifyError(event: MonitorError): void;
}
export interface MonitorReadEvent {
readonly connectionId: string;
readonly data: string;
}
export interface MonitorError {
readonly connectionId: string;
readonly message: string;
readonly code: number;
readonly config: MonitorConfig;
}
export namespace MonitorError {
export namespace ErrorCodes {
/**
* The frontend has refreshed the browser, for instance.
*/
export const CLIENT_CANCEL = 1;
/**
* When detaching a physical device when the duplex channel is still opened.
*/
export const DEVICE_NOT_CONFIGURED = 2;
/**
* Another serial monitor was opened on this port. For another electron-instance, Java IDE.
*/
export const DEVICE_BUSY = 3;
/**
* Another serial monitor was opened on this port. For another electron-instance, Java IDE.
*/
export const interrupted_system_call = 3;
}
}