diff --git a/src/client.ts b/src/client.ts index c713f44..8749bba 100644 --- a/src/client.ts +++ b/src/client.ts @@ -129,7 +129,7 @@ const handleClient = async ( } case Command.getAudio: { - const id = (await stream.readExact(20)); + const id = (await stream.readExact(16)); const result = await processor.getAudio(id); if (result instanceof AudioNotFoundResult) { diff --git a/test/get-audio.test.ts b/test/get-audio.test.ts index 7635ad2..2877f43 100644 --- a/test/get-audio.test.ts +++ b/test/get-audio.test.ts @@ -8,7 +8,7 @@ describe('GetAudio', () => { getAudio: async () => Promise.resolve(new AudioNotFoundResult()), }, async stream => { stream.writeUint8(Command.getAudio); - stream.writeAll(Buffer.from('0'.repeat(40), 'hex')); + stream.writeAll(Buffer.from('0'.repeat(32), 'hex')); const response = await stream.readUint8(); expect(response).toBe(GetAudioResponse.audioNotFound); @@ -25,7 +25,7 @@ describe('GetAudio', () => { }, }, async stream => { stream.writeUint8(Command.getAudio); - stream.writeAll(Buffer.from('0'.repeat(40), 'hex')); + stream.writeAll(Buffer.from('0'.repeat(32), 'hex')); const response = await stream.readUint8(); expect(response).toBe(GetAudioResponse.audioFound); @@ -37,6 +37,6 @@ describe('GetAudio', () => { expect(data).toEqual(Buffer.from('foobar', 'ascii')); }); - expect(result).toEqual({id: Buffer.from('0'.repeat(40), 'hex')}); + expect(result).toEqual({id: Buffer.from('0'.repeat(32), 'hex')}); }); });