Skip to content

Commit 6c3c339

Browse files
committed
Add docs
1 parent e7e678a commit 6c3c339

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

crates/test-programs/src/bin/p2_udp_connect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ fn test_udp_connect_wrong_family(net: &Network, family: IpAddressFamily) {
7676
));
7777
}
7878

79-
/// Connect without an explicit bind should fail.
79+
/// Socket must be explicitly bound before connecting.
8080
fn test_udp_connect_without_bind(family: IpAddressFamily) {
8181
let remote_addr = IpSocketAddress::new(IpAddress::new_loopback(family), SOME_PORT);
8282

crates/wasi/src/sockets/tcp.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@ impl TcpSocket {
381381
}
382382
}
383383

384+
/// Start listening using p2 semantics. (no implicit bind)
384385
pub(crate) fn start_listen_p2(&mut self) -> Result<(), ErrorCode> {
385386
match mem::replace(&mut self.tcp_state, TcpState::Closed) {
386387
TcpState::Bound(tokio_socket) => {
@@ -406,6 +407,7 @@ impl TcpSocket {
406407
self.listen_common(tokio_socket)
407408
}
408409

410+
/// Start listening using p3 semantics. (with implicit bind)
409411
#[cfg(feature = "p3")]
410412
pub(crate) fn listen_p3(&mut self) -> Result<(), ErrorCode> {
411413
let tokio_socket = match mem::replace(&mut self.tcp_state, TcpState::Closed) {

crates/wasi/src/sockets/udp.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ impl UdpSocket {
129129
Ok(())
130130
}
131131

132+
/// Connect using p2 semantics. (no implicit bind)
132133
pub(crate) fn connect_p2(&mut self, addr: SocketAddr) -> Result<(), ErrorCode> {
133134
match self.udp_state {
134135
UdpState::Bound | UdpState::Connected(_) => {}
@@ -138,6 +139,7 @@ impl UdpSocket {
138139
self.connect_common(addr)
139140
}
140141

142+
/// Connect using p3 semantics. (with implicit bind)
141143
#[cfg(feature = "p3")]
142144
pub(crate) fn connect_p3(&mut self, addr: SocketAddr) -> Result<(), ErrorCode> {
143145
match self.udp_state {
@@ -177,6 +179,7 @@ impl UdpSocket {
177179
Ok(())
178180
}
179181

182+
/// Send data using p3 semantics. (with implicit bind)
180183
#[cfg(feature = "p3")]
181184
pub(crate) fn send_p3(
182185
&mut self,
@@ -237,6 +240,7 @@ impl UdpSocket {
237240
}
238241
}
239242

243+
/// Receive data using p3 semantics.
240244
#[cfg(feature = "p3")]
241245
pub(crate) fn receive_p3(
242246
&self,

0 commit comments

Comments
 (0)