Skip to content

Commit e9d5267

Browse files
authored
refactor: rename FRAME_TYPE_OFFSET to fix typo (#259)
Signed-off-by: Kevin Viglucci <[email protected]> Co-authored-by: sudongyuer
1 parent 48d122a commit e9d5267

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/rsocket-core/src/Codecs.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import {
3737
} from "./Frames";
3838

3939
export const FLAGS_MASK = 0x3ff; // low 10 bits
40-
export const FRAME_TYPE_OFFFSET = 10; // frame type is offset 10 bytes within the uint16 containing type + flags
40+
export const FRAME_TYPE_OFFSET = 10; // frame type is offset 10 bytes within the uint16 containing type + flags
4141

4242
export const MAX_CODE = 0x7fffffff; // uint31
4343
export const MAX_KEEPALIVE = 0x7fffffff; // uint31
@@ -176,7 +176,7 @@ export function deserializeFrame(buffer: Buffer): Frame {
176176
// );
177177
const typeAndFlags = buffer.readUInt16BE(offset);
178178
offset += 2;
179-
const type = typeAndFlags >>> FRAME_TYPE_OFFFSET; // keep highest 6 bits
179+
const type = typeAndFlags >>> FRAME_TYPE_OFFSET; // keep highest 6 bits
180180
const flags = typeAndFlags & FLAGS_MASK; // keep lowest 10 bits
181181
switch (type) {
182182
case FrameTypes.SETUP:
@@ -1096,7 +1096,7 @@ function writeHeader(frame: Frame, buffer: Buffer): number {
10961096
const offset = buffer.writeInt32BE(frame.streamId, 0);
10971097
// shift frame to high 6 bits, extract lowest 10 bits from flags
10981098
return buffer.writeUInt16BE(
1099-
(frame.type << FRAME_TYPE_OFFFSET) | (frame.flags & FLAGS_MASK),
1099+
(frame.type << FRAME_TYPE_OFFSET) | (frame.flags & FLAGS_MASK),
11001100
offset
11011101
);
11021102
}

0 commit comments

Comments
 (0)