fix(protocol): keep the highway upload address
The session response address was discarded, so uploads used the default host. Fixes #513
This commit is contained in:
2 files changed
+23
-2
No files matched your search
@@ -302,6 +302,27 @@ describe('fetchHighwaySession trace lifecycle', () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('keeps a server address encoded as a fixed 32-bit field', async () => {
|
||||||
|
// Address field 2 is four raw bytes. The fixture is not produced by the
|
||||||
|
// schema encoder, so a varint declaration cannot hide itself.
|
||||||
|
const responseData = Buffer.from('8a50150a02aabb1201cc1a0c08011208150102030418903f', 'hex');
|
||||||
|
const bridge = {
|
||||||
|
identity: { uin: '10001' },
|
||||||
|
sendRawPacket: vi.fn(async () => ({
|
||||||
|
success: true,
|
||||||
|
gotResponse: true,
|
||||||
|
errorCode: 0,
|
||||||
|
errorMessage: '',
|
||||||
|
responseData,
|
||||||
|
})),
|
||||||
|
} as unknown as BridgeContext;
|
||||||
|
|
||||||
|
const session = await fetchHighwaySession(bridge);
|
||||||
|
|
||||||
|
expect(session.host).toBe('1.2.3.4');
|
||||||
|
expect(session.port).toBe(8080);
|
||||||
|
});
|
||||||
|
|
||||||
it('records a thrown control request as one failed terminal', async () => {
|
it('records a thrown control request as one failed terminal', async () => {
|
||||||
const bridge = {
|
const bridge = {
|
||||||
identity: { uin: '10001' },
|
identity: { uin: '10001' },
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { pb, pb_repeated, int_32, uint_32, uint_64, bool, bytes } from '@snowluma/proton';
|
import type { pb, pb_repeated, int_32, uint_32, uint_64, fixed_32, bool, bytes } from '@snowluma/proton';
|
||||||
import type {
|
import type {
|
||||||
IndexNode,
|
IndexNode,
|
||||||
PictureInfo,
|
PictureInfo,
|
||||||
@@ -185,7 +185,7 @@ export interface HttpConn0x6FF501Request {
|
|||||||
|
|
||||||
export interface ServerAddr {
|
export interface ServerAddr {
|
||||||
type?: pb<1, uint_32>;
|
type?: pb<1, uint_32>;
|
||||||
ip?: pb<2, uint_32>;
|
ip?: pb<2, fixed_32>;
|
||||||
port?: pb<3, uint_32>;
|
port?: pb<3, uint_32>;
|
||||||
area?: pb<4, uint_32>;
|
area?: pb<4, uint_32>;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user