mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 17:34:47 -05:00
chore: make new TCP conn methods unstable (#13686)
This commit is contained in:
parent
be9c2fe267
commit
02c95d367e
3 changed files with 19 additions and 4 deletions
15
cli/dts/lib.deno.unstable.d.ts
vendored
15
cli/dts/lib.deno.unstable.d.ts
vendored
|
@ -1057,6 +1057,21 @@ declare namespace Deno {
|
||||||
alpnProtocols?: string[];
|
alpnProtocols?: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface Conn {
|
||||||
|
/**
|
||||||
|
* **UNSTABLE**: new API, see https://github.com/denoland/deno/issues/13617.
|
||||||
|
*
|
||||||
|
* Enable/disable the use of Nagle's algorithm. Defaults to true.
|
||||||
|
*/
|
||||||
|
setNoDelay(nodelay?: boolean): void;
|
||||||
|
/**
|
||||||
|
* **UNSTABLE**: new API, see https://github.com/denoland/deno/issues/13617.
|
||||||
|
*
|
||||||
|
* Enable/disable keep-alive functionality.
|
||||||
|
*/
|
||||||
|
setKeepAlive(keepalive?: boolean): void;
|
||||||
|
}
|
||||||
|
|
||||||
export interface TlsHandshakeInfo {
|
export interface TlsHandshakeInfo {
|
||||||
/** **UNSTABLE**: new API, yet to be vetted.
|
/** **UNSTABLE**: new API, yet to be vetted.
|
||||||
*
|
*
|
||||||
|
|
4
ext/net/lib.deno_net.d.ts
vendored
4
ext/net/lib.deno_net.d.ts
vendored
|
@ -50,10 +50,6 @@ declare namespace Deno {
|
||||||
/** Shuts down (`shutdown(2)`) the write side of the connection. Most
|
/** Shuts down (`shutdown(2)`) the write side of the connection. Most
|
||||||
* callers should just use `close()`. */
|
* callers should just use `close()`. */
|
||||||
closeWrite(): Promise<void>;
|
closeWrite(): Promise<void>;
|
||||||
/** Enable/disable the use of Nagle's algorithm. Defaults to true */
|
|
||||||
setNoDelay(nodelay?: boolean): void;
|
|
||||||
/** Enable/disable keep-alive functionality */
|
|
||||||
setKeepAlive(keepalive?: boolean): void;
|
|
||||||
|
|
||||||
readonly readable: ReadableStream<Uint8Array>;
|
readonly readable: ReadableStream<Uint8Array>;
|
||||||
readonly writable: WritableStream<Uint8Array>;
|
readonly writable: WritableStream<Uint8Array>;
|
||||||
|
|
|
@ -672,6 +672,7 @@ pub fn op_set_nodelay<NP>(
|
||||||
rid: ResourceId,
|
rid: ResourceId,
|
||||||
nodelay: bool,
|
nodelay: bool,
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
|
super::check_unstable(state, "Deno.Conn#setNoDelay");
|
||||||
let resource: Rc<TcpStreamResource> =
|
let resource: Rc<TcpStreamResource> =
|
||||||
state.resource_table.get::<TcpStreamResource>(rid)?;
|
state.resource_table.get::<TcpStreamResource>(rid)?;
|
||||||
resource.set_nodelay(nodelay)
|
resource.set_nodelay(nodelay)
|
||||||
|
@ -682,6 +683,7 @@ pub fn op_set_keepalive<NP>(
|
||||||
rid: ResourceId,
|
rid: ResourceId,
|
||||||
keepalive: bool,
|
keepalive: bool,
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
|
super::check_unstable(state, "Deno.Conn#setKeepAlive");
|
||||||
let resource: Rc<TcpStreamResource> =
|
let resource: Rc<TcpStreamResource> =
|
||||||
state.resource_table.get::<TcpStreamResource>(rid)?;
|
state.resource_table.get::<TcpStreamResource>(rid)?;
|
||||||
resource.set_keepalive(keepalive)
|
resource.set_keepalive(keepalive)
|
||||||
|
@ -739,6 +741,7 @@ fn rdata_to_return_record(
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
use crate::UnstableChecker;
|
||||||
use deno_core::Extension;
|
use deno_core::Extension;
|
||||||
use deno_core::JsRuntime;
|
use deno_core::JsRuntime;
|
||||||
use deno_core::RuntimeOptions;
|
use deno_core::RuntimeOptions;
|
||||||
|
@ -894,6 +897,7 @@ mod tests {
|
||||||
let my_ext = Extension::builder()
|
let my_ext = Extension::builder()
|
||||||
.state(move |state| {
|
.state(move |state| {
|
||||||
state.put(TestPermission {});
|
state.put(TestPermission {});
|
||||||
|
state.put(UnstableChecker { unstable: true });
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
.build();
|
.build();
|
||||||
|
|
Loading…
Add table
Reference in a new issue