summaryrefslogtreecommitdiff
path: root/ext/net/ops_tls.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-09-12 15:39:21 +0200
committerGitHub <noreply@github.com>2023-09-12 15:39:21 +0200
commit08d2a32060a66e47dcccd99428d2ad13d7af29a9 (patch)
treec4ec82634e24eb2309e32a1063b89ee688a481ec /ext/net/ops_tls.rs
parentbdf1850679ef7d94fbc603f1170af2e232671249 (diff)
refactor: rewrite ext/net/ ops to op2 (#20471)
Diffstat (limited to 'ext/net/ops_tls.rs')
-rw-r--r--ext/net/ops_tls.rs31
1 files changed, 18 insertions, 13 deletions
diff --git a/ext/net/ops_tls.rs b/ext/net/ops_tls.rs
index c2ca3d358..0b84415b9 100644
--- a/ext/net/ops_tls.rs
+++ b/ext/net/ops_tls.rs
@@ -23,7 +23,7 @@ use deno_core::futures::task::Poll;
use deno_core::futures::task::RawWaker;
use deno_core::futures::task::RawWakerVTable;
use deno_core::futures::task::Waker;
-use deno_core::op;
+use deno_core::op2;
use deno_core::parking_lot::Mutex;
use deno_core::unsync::spawn;
@@ -779,10 +779,11 @@ pub struct StartTlsArgs {
alpn_protocols: Option<Vec<String>>,
}
-#[op]
+#[op2(async)]
+#[serde]
pub async fn op_tls_start<NP>(
state: Rc<RefCell<OpState>>,
- args: StartTlsArgs,
+ #[serde] args: StartTlsArgs,
) -> Result<(ResourceId, IpAddr, IpAddr), AnyError>
where
NP: NetPermissions + 'static,
@@ -860,11 +861,12 @@ where
Ok((rid, IpAddr::from(local_addr), IpAddr::from(remote_addr)))
}
-#[op]
+#[op2(async)]
+#[serde]
pub async fn op_net_connect_tls<NP>(
state: Rc<RefCell<OpState>>,
- addr: IpAddr,
- args: ConnectTlsArgs,
+ #[serde] addr: IpAddr,
+ #[serde] args: ConnectTlsArgs,
) -> Result<(ResourceId, IpAddr, IpAddr), AnyError>
where
NP: NetPermissions + 'static,
@@ -1000,11 +1002,12 @@ pub struct ListenTlsArgs {
reuse_port: bool,
}
-#[op]
+#[op2]
+#[serde]
pub fn op_net_listen_tls<NP>(
state: &mut OpState,
- addr: IpAddr,
- args: ListenTlsArgs,
+ #[serde] addr: IpAddr,
+ #[serde] args: ListenTlsArgs,
) -> Result<(ResourceId, IpAddr), AnyError>
where
NP: NetPermissions + 'static,
@@ -1101,10 +1104,11 @@ where
Ok((rid, IpAddr::from(local_addr)))
}
-#[op]
+#[op2(async)]
+#[serde]
pub async fn op_net_accept_tls(
state: Rc<RefCell<OpState>>,
- rid: ResourceId,
+ #[smi] rid: ResourceId,
) -> Result<(ResourceId, IpAddr, IpAddr), AnyError> {
let resource = state
.borrow()
@@ -1142,10 +1146,11 @@ pub async fn op_net_accept_tls(
Ok((rid, IpAddr::from(local_addr), IpAddr::from(remote_addr)))
}
-#[op]
+#[op2(async)]
+#[serde]
pub async fn op_tls_handshake(
state: Rc<RefCell<OpState>>,
- rid: ResourceId,
+ #[smi] rid: ResourceId,
) -> Result<TlsHandshakeInfo, AnyError> {
let resource = state
.borrow()