@@ -7,7 +7,8 @@ use compio_runtime::{BorrowedBuffer, BufferPool};
77use socket2:: { Protocol , SockAddr , Socket as Socket2 , Type } ;
88
99use crate :: {
10- OwnedReadHalf , OwnedWriteHalf , PollFd , ReadHalf , Socket , TcpOpts , ToSocketAddrsAsync , WriteHalf ,
10+ OwnedReadHalf , OwnedWriteHalf , PollFd , ReadHalf , Socket , SocketOpts , ToSocketAddrsAsync ,
11+ WriteHalf ,
1112} ;
1213
1314/// A TCP socket server, listening for connections.
@@ -56,7 +57,7 @@ impl TcpListener {
5657 /// Binding with a port number of 0 will request that the OS assigns a port
5758 /// to this listener.
5859 pub async fn bind ( addr : impl ToSocketAddrsAsync ) -> io:: Result < Self > {
59- Self :: bind_with_options ( addr, TcpOpts :: default ( ) . reuse_address ( true ) ) . await
60+ Self :: bind_with_options ( addr, SocketOpts :: default ( ) . reuse_address ( true ) ) . await
6061 }
6162
6263 /// Creates a new `TcpListener`, which will be bound to the specified
@@ -68,7 +69,7 @@ impl TcpListener {
6869 /// to this listener.
6970 pub async fn bind_with_options (
7071 addr : impl ToSocketAddrsAsync ,
71- options : TcpOpts ,
72+ options : SocketOpts ,
7273 ) -> io:: Result < Self > {
7374 super :: each_addr ( addr, |addr| async move {
7475 let sa = SockAddr :: from ( addr) ;
@@ -172,14 +173,14 @@ impl TcpStream {
172173 /// Opens a TCP connection to a remote host using `TcpOpts`.
173174 pub async fn connect_with_options (
174175 addr : impl ToSocketAddrsAsync ,
175- options : TcpOpts ,
176+ options : SocketOpts ,
176177 ) -> io:: Result < Self > {
177178 Self :: connect_base ( addr, Some ( options) ) . await
178179 }
179180
180181 async fn connect_base (
181182 addr : impl ToSocketAddrsAsync ,
182- options : Option < TcpOpts > ,
183+ options : Option < SocketOpts > ,
183184 ) -> io:: Result < Self > {
184185 use std:: net:: { Ipv4Addr , Ipv6Addr , SocketAddrV4 , SocketAddrV6 } ;
185186
@@ -222,15 +223,15 @@ impl TcpStream {
222223 pub async fn bind_and_connect_with_options (
223224 bind_addr : SocketAddr ,
224225 addr : impl ToSocketAddrsAsync ,
225- options : TcpOpts ,
226+ options : SocketOpts ,
226227 ) -> io:: Result < Self > {
227228 Self :: bind_and_connect_base ( bind_addr, addr, Some ( options) ) . await
228229 }
229230
230231 async fn bind_and_connect_base (
231232 bind_addr : SocketAddr ,
232233 addr : impl ToSocketAddrsAsync ,
233- options : Option < TcpOpts > ,
234+ options : Option < SocketOpts > ,
234235 ) -> io:: Result < Self > {
235236 let options = options. unwrap_or_default ( ) ;
236237 super :: each_addr ( addr, |addr| async move {
0 commit comments