diff options
author | Bert Belder <bertbelder@gmail.com> | 2020-08-18 18:30:13 +0200 |
---|---|---|
committer | Bert Belder <bertbelder@gmail.com> | 2020-08-19 02:01:48 +0200 |
commit | 27f4aeb92469660fdd78a89a7b2902c08a23ca4a (patch) | |
tree | e2076aaf31f0708e5037f46d3750f93b0d637417 /cli/ops/net.rs | |
parent | de1007fc6a2a6c2909732dcb87a5af6c1e370b09 (diff) |
Make Rc/Arc wrapper around State/GlobalState visible (#7104)
Diffstat (limited to 'cli/ops/net.rs')
-rw-r--r-- | cli/ops/net.rs | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/cli/ops/net.rs b/cli/ops/net.rs index 76abcb6c3..445c69106 100644 --- a/cli/ops/net.rs +++ b/cli/ops/net.rs @@ -13,6 +13,7 @@ use futures::future::FutureExt; use std::convert::From; use std::net::Shutdown; use std::net::SocketAddr; +use std::rc::Rc; use std::task::Context; use std::task::Poll; use tokio::net::TcpListener; @@ -22,7 +23,7 @@ use tokio::net::UdpSocket; #[cfg(unix)] use super::net_unix; -pub fn init(i: &mut CoreIsolate, s: &State) { +pub fn init(i: &mut CoreIsolate, s: &Rc<State>) { i.register_op("op_accept", s.stateful_json_op2(op_accept)); i.register_op("op_connect", s.stateful_json_op2(op_connect)); i.register_op("op_shutdown", s.stateful_json_op2(op_shutdown)); @@ -102,7 +103,7 @@ fn accept_tcp( fn op_accept( isolate_state: &mut CoreIsolateState, - _state: &State, + _state: &Rc<State>, args: Value, zero_copy: &mut [ZeroCopyBuf], ) -> Result<JsonOp, OpError> { @@ -126,7 +127,7 @@ struct ReceiveArgs { fn receive_udp( isolate_state: &mut CoreIsolateState, - _state: &State, + _state: &Rc<State>, args: ReceiveArgs, zero_copy: &mut [ZeroCopyBuf], ) -> Result<JsonOp, OpError> { @@ -166,7 +167,7 @@ fn receive_udp( fn op_datagram_receive( isolate_state: &mut CoreIsolateState, - state: &State, + state: &Rc<State>, args: Value, zero_copy: &mut [ZeroCopyBuf], ) -> Result<JsonOp, OpError> { @@ -196,7 +197,7 @@ struct SendArgs { fn op_datagram_send( isolate_state: &mut CoreIsolateState, - state: &State, + state: &Rc<State>, args: Value, zero_copy: &mut [ZeroCopyBuf], ) -> Result<JsonOp, OpError> { @@ -266,7 +267,7 @@ struct ConnectArgs { fn op_connect( isolate_state: &mut CoreIsolateState, - state: &State, + state: &Rc<State>, args: Value, _zero_copy: &mut [ZeroCopyBuf], ) -> Result<JsonOp, OpError> { @@ -352,7 +353,7 @@ struct ShutdownArgs { fn op_shutdown( isolate_state: &mut CoreIsolateState, - state: &State, + state: &Rc<State>, args: Value, _zero_copy: &mut [ZeroCopyBuf], ) -> Result<JsonOp, OpError> { @@ -494,7 +495,7 @@ fn listen_udp( fn op_listen( isolate_state: &mut CoreIsolateState, - state: &State, + state: &Rc<State>, args: Value, _zero_copy: &mut [ZeroCopyBuf], ) -> Result<JsonOp, OpError> { |