Skip to content

Commit

Permalink
net: expose shutdown TS def (denoland#3560)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinkassimo authored and bartlomieju committed Dec 30, 2019
1 parent 176d1ff commit df1665a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions cli/js/lib.deno_runtime.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1148,6 +1148,24 @@ declare namespace Deno {
address: string;
}

export enum ShutdownMode {
// See http:https://man7.org/linux/man-pages/man2/shutdown.2.html
// Corresponding to SHUT_RD, SHUT_WR, SHUT_RDWR
Read = 0,
Write,
ReadWrite // unused
}

/** Shut down socket send and receive operations.
*
* Matches behavior of POSIX shutdown(3).
*
* const listener = Deno.listen({ port: 80 });
* const conn = await listener.accept();
* Deno.shutdown(conn.rid, Deno.ShutdownMode.Write);
*/
export function shutdown(rid: number, how: ShutdownMode): void;

/** A Listener is a generic network listener for stream-oriented protocols. */
export interface Listener extends AsyncIterator<Conn> {
/** Waits for and resolves to the next connection to the `Listener`. */
Expand Down

0 comments on commit df1665a

Please sign in to comment.