Skip to content

Commit 0ca1bd4

Browse files
committed
Inline payload limit
1 parent 7ceb15b commit 0ca1bd4

4 files changed

Lines changed: 9 additions & 7 deletions

File tree

src/common/parser/ApcParser.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
import { IApcHandler, IHandlerCollection, ApcFallbackHandlerType, IApcParser, ISubParserStackState } from 'common/parser/Types';
7-
import { ApcState, PAYLOAD_LIMIT } from 'common/parser/Constants';
7+
import { ApcState, ParserConstants } from 'common/parser/Constants';
88
import { utf32ToString } from 'common/input/TextDecoder';
99
import { IDisposable } from 'common/Types';
1010

@@ -199,7 +199,7 @@ export class ApcParser implements IApcParser {
199199
* as APC handlers.
200200
*/
201201
export class ApcHandler implements IApcHandler {
202-
private static PAYLOAD_LIMIT = PAYLOAD_LIMIT;
202+
private static PAYLOAD_LIMIT = ParserConstants.PAYLOAD_LIMIT;
203203

204204
private _data = '';
205205
private _hitLimit: boolean = false;

src/common/parser/Constants.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,6 @@ export const enum ApcState {
7171
}
7272

7373
// payload limit for OSC and DCS
74-
export const PAYLOAD_LIMIT = 10000000;
74+
export const enum ParserConstants {
75+
PAYLOAD_LIMIT = 10000000
76+
}

src/common/parser/DcsParser.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { IDisposable } from 'common/Types';
77
import { IDcsHandler, IParams, IHandlerCollection, IDcsParser, DcsFallbackHandlerType, ISubParserStackState } from 'common/parser/Types';
88
import { utf32ToString } from 'common/input/TextDecoder';
99
import { Params } from 'common/parser/Params';
10-
import { PAYLOAD_LIMIT } from 'common/parser/Constants';
10+
import { ParserConstants } from 'common/parser/Constants';
1111

1212
const EMPTY_HANDLERS: IDcsHandler[] = [];
1313

@@ -138,7 +138,7 @@ EMPTY_PARAMS.addParam(0);
138138
* Note: The payload is currently limited to 50 MB (hardcoded).
139139
*/
140140
export class DcsHandler implements IDcsHandler {
141-
private static PAYLOAD_LIMIT = PAYLOAD_LIMIT;
141+
private static PAYLOAD_LIMIT = ParserConstants.PAYLOAD_LIMIT;
142142

143143
private _data = '';
144144
private _params: IParams = EMPTY_PARAMS;

src/common/parser/OscParser.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
import { IOscHandler, IHandlerCollection, OscFallbackHandlerType, IOscParser, ISubParserStackState } from 'common/parser/Types';
7-
import { OscState, PAYLOAD_LIMIT } from 'common/parser/Constants';
7+
import { OscState, ParserConstants } from 'common/parser/Constants';
88
import { utf32ToString } from 'common/input/TextDecoder';
99
import { IDisposable } from 'common/Types';
1010

@@ -192,7 +192,7 @@ export class OscParser implements IOscParser {
192192
* as OSC handlers.
193193
*/
194194
export class OscHandler implements IOscHandler {
195-
private static PAYLOAD_LIMIT = PAYLOAD_LIMIT;
195+
private static PAYLOAD_LIMIT = ParserConstants.PAYLOAD_LIMIT;
196196

197197
private _data = '';
198198
private _hitLimit: boolean = false;

0 commit comments

Comments
 (0)