1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-11 08:33:43 -05:00

cleanup(ext/net): consistent op names (#12607)

This commit is contained in:
Aaron O'Mullan 2021-10-30 18:51:42 +02:00 committed by GitHub
parent a24735aa66
commit 94a81e5e9b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 36 additions and 42 deletions

View file

@ -31,27 +31,27 @@
}
function opAccept(rid, transport) {
return core.opAsync("op_accept", { rid, transport });
return core.opAsync("op_net_accept", { rid, transport });
}
function opListen(args) {
return core.opSync("op_listen", args);
return core.opSync("op_net_listen", args);
}
function opConnect(args) {
return core.opAsync("op_connect", args);
return core.opAsync("op_net_connect", args);
}
function opReceive(rid, transport, zeroCopy) {
return core.opAsync(
"op_datagram_receive",
"op_dgram_recv",
{ rid, transport },
zeroCopy,
);
}
function opSend(args, zeroCopy) {
return core.opAsync("op_datagram_send", args, zeroCopy);
return core.opAsync("op_dgram_send", args, zeroCopy);
}
function resolveDns(query, recordType, options) {

View file

@ -8,19 +8,19 @@
function opConnectTls(
args,
) {
return core.opAsync("op_connect_tls", args);
return core.opAsync("op_tls_connect", args);
}
function opAcceptTLS(rid) {
return core.opAsync("op_accept_tls", rid);
return core.opAsync("op_tls_accept", rid);
}
function opListenTls(args) {
return core.opSync("op_listen_tls", args);
return core.opSync("op_tls_listen", args);
}
function opStartTls(args) {
return core.opAsync("op_start_tls", args);
return core.opAsync("op_tls_start", args);
}
function opTlsHandshake(rid) {

View file

@ -12,20 +12,14 @@ Following ops are provided:
- "op_net_read_async"
- "op_net_write_async"
- "op_net_shutdown"
- "op_accept"
- "op_connect"
- "op_listen"
- "op_datagram_receive"
- "op_datagram_send"
- "op_net_accept"
- "op_net_connect"
- "op_net_listen"
- "op_dgram_recv"
- "op_dgram_send"
- "op_dns_resolve"
- "op_start_tls"
- "op_connect_tls"
- "op_listen_tls"
- "op_accept_tls"
- "op_tls_start"
- "op_tls_connect"
- "op_tls_listen"
- "op_tls_accept"
- "op_tls_handshake"
- "op_http_start"
- "op_http_request_next"
- "op_http_request_read"
- "op_http_response"
- "op_http_response_write"
- "op_http_response_close"

View file

@ -48,11 +48,11 @@ use std::path::Path;
pub fn init<P: NetPermissions + 'static>() -> Vec<OpPair> {
vec![
("op_accept", op_async(op_accept)),
("op_connect", op_async(op_connect::<P>)),
("op_listen", op_sync(op_listen::<P>)),
("op_datagram_receive", op_async(op_datagram_receive)),
("op_datagram_send", op_async(op_datagram_send::<P>)),
("op_net_accept", op_async(op_net_accept)),
("op_net_connect", op_async(op_net_connect::<P>)),
("op_net_listen", op_sync(op_net_listen::<P>)),
("op_dgram_recv", op_async(op_dgram_recv)),
("op_dgram_send", op_async(op_dgram_send::<P>)),
("op_dns_resolve", op_async(op_dns_resolve::<P>)),
]
}
@ -141,7 +141,7 @@ async fn accept_tcp(
})
}
async fn op_accept(
async fn op_net_accept(
state: Rc<RefCell<OpState>>,
args: AcceptArgs,
_: (),
@ -193,7 +193,7 @@ async fn receive_udp(
})
}
async fn op_datagram_receive(
async fn op_dgram_recv(
state: Rc<RefCell<OpState>>,
args: ReceiveArgs,
zero_copy: ZeroCopyBuf,
@ -214,7 +214,7 @@ struct SendArgs {
transport_args: ArgsEnum,
}
async fn op_datagram_send<NP>(
async fn op_dgram_send<NP>(
state: Rc<RefCell<OpState>>,
args: SendArgs,
zero_copy: ZeroCopyBuf,
@ -282,7 +282,7 @@ pub struct ConnectArgs {
transport_args: ArgsEnum,
}
pub async fn op_connect<NP>(
pub async fn op_net_connect<NP>(
state: Rc<RefCell<OpState>>,
args: ConnectArgs,
_: (),
@ -444,7 +444,7 @@ fn listen_udp(
Ok((rid, local_addr))
}
fn op_listen<NP>(
fn op_net_listen<NP>(
state: &mut OpState,
args: ListenArgs,
_: (),

View file

@ -684,10 +684,10 @@ impl Write for ImplementWriteTrait<'_, TcpStream> {
pub fn init<P: NetPermissions + 'static>() -> Vec<OpPair> {
vec![
("op_start_tls", op_async(op_start_tls::<P>)),
("op_connect_tls", op_async(op_connect_tls::<P>)),
("op_listen_tls", op_sync(op_listen_tls::<P>)),
("op_accept_tls", op_async(op_accept_tls)),
("op_tls_start", op_async(op_tls_start::<P>)),
("op_tls_connect", op_async(op_tls_connect::<P>)),
("op_tls_listen", op_sync(op_tls_listen::<P>)),
("op_tls_accept", op_async(op_tls_accept)),
("op_tls_handshake", op_async(op_tls_handshake)),
]
}
@ -780,7 +780,7 @@ struct StartTlsArgs {
hostname: String,
}
async fn op_start_tls<NP>(
async fn op_tls_start<NP>(
state: Rc<RefCell<OpState>>,
args: StartTlsArgs,
_: (),
@ -862,7 +862,7 @@ where
})
}
pub async fn op_connect_tls<NP>(
pub async fn op_tls_connect<NP>(
state: Rc<RefCell<OpState>>,
args: ConnectTlsArgs,
_: (),
@ -1013,7 +1013,7 @@ pub struct ListenTlsArgs {
alpn_protocols: Option<Vec<String>>,
}
fn op_listen_tls<NP>(
fn op_tls_listen<NP>(
state: &mut OpState,
args: ListenTlsArgs,
_: (),
@ -1073,7 +1073,7 @@ where
})
}
async fn op_accept_tls(
async fn op_tls_accept(
state: Rc<RefCell<OpState>>,
rid: ResourceId,
_: (),