11use crate :: p2:: bindings:: sockets:: network:: { ErrorCode , IpAddressFamily , IpSocketAddress , Network } ;
22use crate :: p2:: bindings:: sockets:: udp;
33use crate :: p2:: udp:: { IncomingDatagramStream , OutgoingDatagramStream , SendState , UdpState } ;
4- use crate :: p2:: { Pollable , SocketError , SocketResult , WasiCtxView } ;
4+ use crate :: p2:: { Pollable , SocketError , SocketResult } ;
55use crate :: sockets:: util:: {
66 get_ip_ttl, get_ipv6_unicast_hops, is_valid_address_family, is_valid_remote_address,
77 receive_buffer_size, send_buffer_size, set_receive_buffer_size, set_send_buffer_size,
88 set_unicast_hop_limit, udp_bind, udp_disconnect,
99} ;
10- use crate :: sockets:: { MAX_UDP_DATAGRAM_SIZE , SocketAddrUse , SocketAddressFamily } ;
10+ use crate :: sockets:: {
11+ MAX_UDP_DATAGRAM_SIZE , SocketAddrUse , SocketAddressFamily , WasiSocketsCtxView ,
12+ } ;
1113use anyhow:: anyhow;
1214use async_trait:: async_trait;
1315use io_lifetimes:: AsSocketlike ;
@@ -17,16 +19,16 @@ use tokio::io::Interest;
1719use wasmtime:: component:: Resource ;
1820use wasmtime_wasi_io:: poll:: DynPollable ;
1921
20- impl udp:: Host for WasiCtxView < ' _ > { }
22+ impl udp:: Host for WasiSocketsCtxView < ' _ > { }
2123
22- impl udp:: HostUdpSocket for WasiCtxView < ' _ > {
24+ impl udp:: HostUdpSocket for WasiSocketsCtxView < ' _ > {
2325 async fn start_bind (
2426 & mut self ,
2527 this : Resource < udp:: UdpSocket > ,
2628 network : Resource < Network > ,
2729 local_address : IpSocketAddress ,
2830 ) -> SocketResult < ( ) > {
29- self . ctx . sockets . allowed_network_uses . check_allowed_udp ( ) ?;
31+ self . ctx . allowed_network_uses . check_allowed_udp ( ) ?;
3032
3133 match self . table . get ( & this) ?. udp_state {
3234 UdpState :: Default => { }
@@ -274,7 +276,7 @@ impl udp::HostUdpSocket for WasiCtxView<'_> {
274276 }
275277}
276278
277- impl udp:: HostIncomingDatagramStream for WasiCtxView < ' _ > {
279+ impl udp:: HostIncomingDatagramStream for WasiSocketsCtxView < ' _ > {
278280 fn receive (
279281 & mut self ,
280282 this : Resource < udp:: IncomingDatagramStream > ,
@@ -362,7 +364,7 @@ impl Pollable for IncomingDatagramStream {
362364 }
363365}
364366
365- impl udp:: HostOutgoingDatagramStream for WasiCtxView < ' _ > {
367+ impl udp:: HostOutgoingDatagramStream for WasiSocketsCtxView < ' _ > {
366368 fn check_send ( & mut self , this : Resource < udp:: OutgoingDatagramStream > ) -> SocketResult < u64 > {
367369 let stream = self . table . get_mut ( & this) ?;
368370
@@ -506,7 +508,7 @@ pub mod sync {
506508 use wasmtime:: component:: Resource ;
507509
508510 use crate :: p2:: {
509- SocketError , WasiCtxView ,
511+ SocketError ,
510512 bindings:: {
511513 sockets:: {
512514 network:: Network ,
@@ -526,10 +528,11 @@ pub mod sync {
526528 } ,
527529 } ;
528530 use crate :: runtime:: in_tokio;
531+ use crate :: sockets:: WasiSocketsCtxView ;
529532
530- impl udp:: Host for WasiCtxView < ' _ > { }
533+ impl udp:: Host for WasiSocketsCtxView < ' _ > { }
531534
532- impl HostUdpSocket for WasiCtxView < ' _ > {
535+ impl HostUdpSocket for WasiSocketsCtxView < ' _ > {
533536 fn start_bind (
534537 & mut self ,
535538 self_ : Resource < UdpSocket > ,
@@ -628,7 +631,7 @@ pub mod sync {
628631 }
629632 }
630633
631- impl HostIncomingDatagramStream for WasiCtxView < ' _ > {
634+ impl HostIncomingDatagramStream for WasiSocketsCtxView < ' _ > {
632635 fn receive (
633636 & mut self ,
634637 self_ : Resource < IncomingDatagramStream > ,
@@ -667,7 +670,7 @@ pub mod sync {
667670 }
668671 }
669672
670- impl HostOutgoingDatagramStream for WasiCtxView < ' _ > {
673+ impl HostOutgoingDatagramStream for WasiSocketsCtxView < ' _ > {
671674 fn check_send (
672675 & mut self ,
673676 self_ : Resource < OutgoingDatagramStream > ,
0 commit comments