Skip to content

Commit

Permalink
feat: Stabilize Deno.TcpConn.setNoDelay() and Deno.TcpConn.setKeepAli…
Browse files Browse the repository at this point in the history
…ve() (denoland#17003)

This commit stabilizes following APIs:
- `Deno.TcpConn.setNoDelay()`
- `Deno.TcpConn.setKeepAlive()`
  • Loading branch information
bartlomieju authored Dec 13, 2022
1 parent 392cca8 commit f9db129
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 18 deletions.
8 changes: 4 additions & 4 deletions ext/net/01_net.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
14 changes: 4 additions & 10 deletions ext/net/lib.deno_net.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]
*/
setNoDelay(nodelay?: boolean): void;
/**
* **UNSTABLE**: new API, see https://github.com/denoland/deno/issues/13617.
*
* Enable/disable keep-alive functionality.
* @param [noDelay=true]
*/
setKeepAlive(keepalive?: boolean): void;
setNoDelay(noDelay?: boolean): void;
/** Enable/disable keep-alive functionality. */
setKeepAlive(keepAlive?: boolean): void;
}

/** @category Network */
Expand Down
2 changes: 0 additions & 2 deletions ext/net/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
1 change: 0 additions & 1 deletion ops/optimizer_tests/unit_result2.out
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;
Expand Down
1 change: 0 additions & 1 deletion ops/optimizer_tests/unit_result2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f9db129

Please sign in to comment.