summaryrefslogtreecommitdiff
path: root/cli/js/lib.deno_runtime.d.ts
diff options
context:
space:
mode:
authorKevin (Kun) "Kassimo" Qian <kevinkassimo@gmail.com>2019-12-30 02:30:20 -0800
committerBartek IwaƄczuk <biwanczuk@gmail.com>2019-12-30 11:30:20 +0100
commitdf1665a8fc92168c3eb115a768ecfeccbe575e18 (patch)
tree6ff0831c4ae896e26a43c73be1ba5ae6ad2c3853 /cli/js/lib.deno_runtime.d.ts
parent176d1ff12e1984593282b58adf54f34f971be837 (diff)
net: expose shutdown TS def (#3560)
Diffstat (limited to 'cli/js/lib.deno_runtime.d.ts')
-rw-r--r--cli/js/lib.deno_runtime.d.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/cli/js/lib.deno_runtime.d.ts b/cli/js/lib.deno_runtime.d.ts
index d955c09bf..a9636a4c4 100644
--- a/cli/js/lib.deno_runtime.d.ts
+++ b/cli/js/lib.deno_runtime.d.ts
@@ -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`. */