1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

feat: Stabilize Deno.TcpConn.setNoDelay() and Deno.TcpConn.setKeepAlive() (#17003)

This commit stabilizes following APIs:
- `Deno.TcpConn.setNoDelay()`
- `Deno.TcpConn.setKeepAlive()`
This commit is contained in:
Bartek Iwańczuk 2022-12-14 00:54:11 +01:00 committed by GitHub
parent 392cca87a8
commit f9db129bdf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 18 deletions

View file

@ -100,12 +100,12 @@
}
class TcpConn extends Conn {
setNoDelay(nodelay = true) {
return ops.op_set_nodelay(this.rid, nodelay);
setNoDelay(noDelay = true) {
return ops.op_set_nodelay(this.rid, noDelay);
}
setKeepAlive(keepalive = true) {
return ops.op_set_keepalive(this.rid, keepalive);
setKeepAlive(keepAlive = true) {
return ops.op_set_keepalive(this.rid, keepAlive);
}
}

View file

@ -185,19 +185,13 @@ declare namespace Deno {
/** @category Network */
export interface TcpConn extends Conn {
/**
* **UNSTABLE**: new API, see https://github.com/denoland/deno/issues/13617.
*
* Enable/disable the use of Nagle's algorithm.
*
* @param [nodelay=true]
* @param [noDelay=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;
setNoDelay(noDelay?: boolean): void;
/** Enable/disable keep-alive functionality. */
setKeepAlive(keepAlive?: boolean): void;
}
/** @category Network */

View file

@ -514,7 +514,6 @@ pub fn op_set_nodelay(
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)
@ -526,7 +525,6 @@ pub fn op_set_keepalive(
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)

View file

@ -36,7 +36,6 @@ impl op_set_nodelay {
rid: ResourceId,
nodelay: bool,
) -> Result<(), AnyError> {
super::check_unstable(state, "Deno.Conn#setNoDelay");
let resource: Rc<TcpStreamResource> = state
.resource_table
.get::<TcpStreamResource>(rid)?;

View file

@ -3,7 +3,6 @@ pub fn op_set_nodelay(
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)