File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ use crate::PollFd;
2323
2424#[ derive( Debug , Clone ) ]
2525pub struct Socket {
26- socket : Attacher < Socket2 > ,
26+ pub ( crate ) socket : Attacher < Socket2 > ,
2727}
2828
2929impl Socket {
Original file line number Diff line number Diff line change @@ -56,8 +56,10 @@ impl TcpListener {
5656 /// to this listener.
5757 pub async fn bind ( addr : impl ToSocketAddrsAsync ) -> io:: Result < Self > {
5858 super :: each_addr ( addr, |addr| async move {
59- let socket =
60- Socket :: bind ( & SockAddr :: from ( addr) , Type :: STREAM , Some ( Protocol :: TCP ) ) . await ?;
59+ let sa = SockAddr :: from ( addr) ;
60+ let socket = Socket :: new ( sa. domain ( ) , Type :: STREAM , Some ( Protocol :: TCP ) ) . await ?;
61+ socket. socket . set_reuse_address ( true ) ?;
62+ socket. socket . bind ( & sa) ?;
6163 socket. listen ( 128 ) ?;
6264 Ok ( Self { inner : socket } )
6365 } )
You can’t perform that action at this time.
0 commit comments