0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-03 09:31:22 -05:00

net: expose shutdown TS def (#3560)

This commit is contained in:
Kevin (Kun) "Kassimo" Qian 2019-12-30 02:30:20 -08:00 committed by Bartek Iwańczuk
parent 176d1ff12e
commit df1665a8fc

View file

@ -1148,6 +1148,24 @@ declare namespace Deno {
address: string;
}
export enum ShutdownMode {
// See http://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`. */