summaryrefslogtreecommitdiff
path: root/runtime/ops/tls.rs
diff options
context:
space:
mode:
authorAaron O'Mullan <aaron.omullan@gmail.com>2021-05-03 01:22:57 +0200
committerGitHub <noreply@github.com>2021-05-02 19:22:57 -0400
commit8377957666d6ca80d48d6fa78afd3e16bf3f7aa8 (patch)
tree071564d391846624c18b81cdccf3350c2e73ed13 /runtime/ops/tls.rs
parent40961cda583faaba128b555caebf284fd6298bb1 (diff)
refactor(runtime): use Extensions (#10461)
Diffstat (limited to 'runtime/ops/tls.rs')
-rw-r--r--runtime/ops/tls.rs17
1 files changed, 12 insertions, 5 deletions
diff --git a/runtime/ops/tls.rs b/runtime/ops/tls.rs
index 0dbf35cc4..e1a9a737f 100644
--- a/runtime/ops/tls.rs
+++ b/runtime/ops/tls.rs
@@ -15,9 +15,12 @@ use deno_core::error::custom_error;
use deno_core::error::generic_error;
use deno_core::error::invalid_hostname;
use deno_core::error::AnyError;
+use deno_core::op_async;
+use deno_core::op_sync;
use deno_core::AsyncRefCell;
use deno_core::CancelHandle;
use deno_core::CancelTryFuture;
+use deno_core::Extension;
use deno_core::OpState;
use deno_core::RcRef;
use deno_core::Resource;
@@ -71,11 +74,15 @@ impl StoresClientSessions for ClientSessionMemoryCache {
}
}
-pub fn init(rt: &mut deno_core::JsRuntime) {
- super::reg_async(rt, "op_start_tls", op_start_tls);
- super::reg_async(rt, "op_connect_tls", op_connect_tls);
- super::reg_sync(rt, "op_listen_tls", op_listen_tls);
- super::reg_async(rt, "op_accept_tls", op_accept_tls);
+pub fn init() -> Extension {
+ Extension::builder()
+ .ops(vec![
+ ("op_start_tls", op_async(op_start_tls)),
+ ("op_connect_tls", op_async(op_connect_tls)),
+ ("op_listen_tls", op_sync(op_listen_tls)),
+ ("op_accept_tls", op_async(op_accept_tls)),
+ ])
+ .build()
}
#[derive(Deserialize)]