summaryrefslogtreecommitdiff
path: root/ext/websocket/lib.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-09-02 08:48:21 +0200
committerGitHub <noreply@github.com>2023-09-02 08:48:21 +0200
commit83426be6eead06c680ae527468aeaf8723543ff2 (patch)
tree322c6659e366c8bf6029cd7082d10947d7dca9b5 /ext/websocket/lib.rs
parente1fb48524d2730bf7c7dfaf021bf39de2d5903bb (diff)
refactor: rewrite ops that use 'deferred' to use 'op2(async(lazy))' (#20303)
Rewrites 3 ops that used "op(deferred)" to use "op2(async(lazy))" instead. This will allow us to remove codepath for handling "deferred" ops in "deno_core".
Diffstat (limited to 'ext/websocket/lib.rs')
-rw-r--r--ext/websocket/lib.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/ext/websocket/lib.rs b/ext/websocket/lib.rs
index 4b05131d9..32e2d18cc 100644
--- a/ext/websocket/lib.rs
+++ b/ext/websocket/lib.rs
@@ -5,6 +5,7 @@ use deno_core::error::invalid_hostname;
use deno_core::error::type_error;
use deno_core::error::AnyError;
use deno_core::op;
+use deno_core::op2;
use deno_core::url;
use deno_core::AsyncMutFuture;
use deno_core::AsyncRefCell;
@@ -528,12 +529,12 @@ pub async fn op_ws_send_ping(
.await
}
-#[op(deferred)]
+#[op2(async(lazy))]
pub async fn op_ws_close(
state: Rc<RefCell<OpState>>,
- rid: ResourceId,
+ #[smi] rid: ResourceId,
code: Option<u16>,
- reason: Option<String>,
+ #[string] reason: Option<String>,
) -> Result<(), AnyError> {
let resource = state
.borrow_mut()