mirror of
https://github.com/denoland/deno.git
synced 2024-11-24 15:19:26 -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[];
|
||||
}
|
||||
|
||||
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 {
|
||||
/** **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
|
||||
* callers should just use `close()`. */
|
||||
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 writable: WritableStream<Uint8Array>;
|
||||
|
|
|
@ -672,6 +672,7 @@ pub fn op_set_nodelay<NP>(
|
|||
rid: ResourceId,
|
||||
nodelay: bool,
|
||||
) -> Result<(), AnyError> {
|
||||
super::check_unstable(state, "Deno.Conn#setNoDelay");
|
||||
let resource: Rc<TcpStreamResource> =
|
||||
state.resource_table.get::<TcpStreamResource>(rid)?;
|
||||
resource.set_nodelay(nodelay)
|
||||
|
@ -682,6 +683,7 @@ pub fn op_set_keepalive<NP>(
|
|||
rid: ResourceId,
|
||||
keepalive: bool,
|
||||
) -> Result<(), AnyError> {
|
||||
super::check_unstable(state, "Deno.Conn#setKeepAlive");
|
||||
let resource: Rc<TcpStreamResource> =
|
||||
state.resource_table.get::<TcpStreamResource>(rid)?;
|
||||
resource.set_keepalive(keepalive)
|
||||
|
@ -739,6 +741,7 @@ fn rdata_to_return_record(
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::UnstableChecker;
|
||||
use deno_core::Extension;
|
||||
use deno_core::JsRuntime;
|
||||
use deno_core::RuntimeOptions;
|
||||
|
@ -894,6 +897,7 @@ mod tests {
|
|||
let my_ext = Extension::builder()
|
||||
.state(move |state| {
|
||||
state.put(TestPermission {});
|
||||
state.put(UnstableChecker { unstable: true });
|
||||
Ok(())
|
||||
})
|
||||
.build();
|
||||
|
|
Loading…
Reference in a new issue