Skip to content

Commit 20d7d97

Browse files
authored
net: make close/0, select/2 and remote/0 methods of UdpSocket pub (#24004)
1 parent 1c1eb46 commit 20d7d97

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

vlib/net/udp.c.v

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,18 +274,21 @@ pub fn (mut s UdpSocket) set_dualstack(on bool) ! {
274274
sizeof(int)))!
275275
}
276276

277-
fn (mut s UdpSocket) close() ! {
277+
// close shuts down and closes the socket for communication.
278+
pub fn (mut s UdpSocket) close() ! {
278279
shutdown(s.handle)
279280
return close(s.handle)
280281
}
281282

282-
fn (mut s UdpSocket) select(test Select, timeout time.Duration) !bool {
283+
// select waits for no more than `timeout` for the IO operation, defined by `test`, to be available.
284+
pub fn (mut s UdpSocket) select(test Select, timeout time.Duration) !bool {
283285
return select(s.handle, test, timeout)
284286
}
285287

286-
fn (s &UdpSocket) remote() !Addr {
288+
// remote returns the remote `Addr` address of the socket or `none` if no remote is has been resolved.
289+
pub fn (s &UdpSocket) remote() ?Addr {
287290
if s.has_r {
288291
return s.r
289292
}
290-
return error('none')
293+
return none
291294
}

0 commit comments

Comments
 (0)