Skip to content

Commit cf63ac0

Browse files
committed
chore: 🤖 general cleanup
1 parent 64ad66b commit cf63ac0

File tree

4 files changed

+9
-305
lines changed

4 files changed

+9
-305
lines changed

src/rpc/CHANGES.md

Lines changed: 0 additions & 130 deletions
This file was deleted.

src/rpc/RFC_COMPLIANCE.md

Lines changed: 0 additions & 165 deletions
This file was deleted.

src/rpc/RpcMessageDecoder.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {Reader} from '@jsonjoy.com/buffers/lib/Reader';
2-
import {RpcMsgType, RpcReplyStat, RpcAcceptStat, RpcRejectStat, RPC_VERSION} from './constants';
2+
import {RpcMsgType, RpcReplyStat, RpcAcceptStat, RpcRejectStat} from './constants';
33
import {RpcDecodingError} from './errors';
44
import {
55
RpcOpaqueAuth,
@@ -81,16 +81,12 @@ export class RpcMessageDecoder {
8181
if (reader.size() < 8) return undefined;
8282
const flavor = reader.u32();
8383
const length = reader.u32();
84-
if (length > 400) {
85-
throw new RpcDecodingError('Auth body too large');
86-
}
84+
if (length > 400) throw new RpcDecodingError('Auth body too large');
8785
const paddedLength = (length + 3) & ~3;
8886
if (reader.size() < paddedLength) return undefined;
8987
const body = length > 0 ? reader.cut(length) : new Reader(new Uint8Array(0));
9088
const padding = paddedLength - length;
91-
if (padding > 0) {
92-
reader.skip(padding);
93-
}
89+
if (padding > 0) reader.skip(padding);
9490
return new RpcOpaqueAuth(flavor, body);
9591
}
9692
}

src/rpc/__tests__/real-traces.spec.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,13 @@ const decode = (hex: string): RpcMessage | undefined => {
1616
return undefined;
1717
};
1818

19+
const nfs3LookupCallHex =
20+
'80000090eb8a42cb0000000000000002000186a30000000300000003000000010000003c00490e680000001d455042594d494e573039333554312e6d696e736b2e6570616d2e636f6d000000000001f40000000a000000020000000a000001f400000000000000000000001c9725bb51046621880c000000a68c020078286c3e00000000000000000000000568656c6c6f000000';
21+
const nfs3AccessCallHex =
22+
'80000088ea8a42cb0000000000000002000186a30000000300000004000000010000003c00490e680000001d455042594d494e573039333554312e6d696e736b2e6570616d2e636f6d000000000001f40000000a000000020000000a000001f400000000000000000000001c9725bb51046621880c000000a68c020078286c3e00000000000000000000001f';
23+
1924
test('RPC Call', () => {
20-
const hex =
21-
'80000090eb8a42cb0000000000000002000186a30000000300000003000000010000003c00490e680000001d455042594d494e573039333554312e6d696e736b2e6570616d2e636f6d000000000001f40000000a000000020000000a000001f400000000000000000000001c9725bb51046621880c000000a68c020078286c3e00000000000000000000000568656c6c6f000000';
22-
const msg = decode(hex)!;
25+
const msg = decode(nfs3LookupCallHex)!;
2326
expect(msg.xid).toBe(0xeb8a42cb);
2427
// console.log(msg);
2528
});

0 commit comments

Comments
 (0)