Skip to content

Commit

Permalink
refactor: IO resource types, fix concurrent read/write and graceful c…
Browse files Browse the repository at this point in the history
…lose (denoland/deno#9118)

Fixes: 9032.
  • Loading branch information
piscisaureus authored and caspervonb committed Jan 31, 2021
1 parent 11ba7b1 commit 8a1224c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion http/_mock_conn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ export function mockConn(base: Partial<Deno.Conn> = {}): Deno.Conn {
port: 0,
},
rid: -1,
closeWrite: (): void => {},
closeWrite: (): Promise<void> => {
return Promise.resolve();
},
read: (): Promise<number | null> => {
return Promise.resolve(0);
},
Expand Down
4 changes: 2 additions & 2 deletions ws/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Deno.test("[ws] read unmasked ping / pong frame", async () => {
);
assertEquals(actual1, "Hello");
// deno-fmt-ignore
const pongFrame= [0x8a, 0x85, 0x37, 0xfa, 0x21, 0x3d, 0x7f, 0x9f, 0x4d, 0x51, 0x58]
const pongFrame = [0x8a, 0x85, 0x37, 0xfa, 0x21, 0x3d, 0x7f, 0x9f, 0x4d, 0x51, 0x58]
const buf2 = new BufReader(new Deno.Buffer(new Uint8Array(pongFrame)));
const pong = await readFrame(buf2);
assertEquals(pong.opcode, OpCode.Pong);
Expand Down Expand Up @@ -283,7 +283,7 @@ Deno.test("[ws] ws.close() should use 1000 as close code", async () => {
function dummyConn(r: Deno.Reader, w: Deno.Writer): Deno.Conn {
return {
rid: -1,
closeWrite: (): void => {},
closeWrite: (): Promise<void> => Promise.resolve(),
read: (x: Uint8Array): Promise<number | null> => r.read(x),
write: (x: Uint8Array): Promise<number> => w.write(x),
close: (): void => {},
Expand Down

0 comments on commit 8a1224c

Please sign in to comment.