File tree Expand file tree Collapse file tree 3 files changed +6
-11
lines changed
Expand file tree Collapse file tree 3 files changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -277,17 +277,12 @@ impl Udp {
277277
278278 Ok ( UdpSocket :: new ( addr, rx) )
279279 }
280- pub ( crate ) fn connect ( & mut self , src : SocketAddr , dst : SocketAddr ) -> io :: Result < ( ) > {
280+ pub ( crate ) fn connect ( & mut self , src : SocketAddr , dst : SocketAddr ) {
281281 let Some ( bind) = self . binds . get_mut ( & src. port ( ) ) else {
282- return Err ( io:: Error :: new (
283- io:: ErrorKind :: NotFound ,
284- "Connect failed (no matching bind) for {src}" ,
285- ) ) ;
282+ panic ! ( "Connect failed (no matching bind) for {src}" ) ;
286283 } ;
287284
288285 bind. target_addr = Some ( dst) ;
289-
290- Ok ( ( ) )
291286 }
292287
293288 fn receive_from_network ( & mut self , src : SocketAddr , dst : SocketAddr , datagram : Datagram ) {
Original file line number Diff line number Diff line change @@ -156,12 +156,12 @@ impl UdpSocket {
156156 } ) ,
157157 }
158158 }
159- pub async fn connect < A : ToSocketAddrs > ( & self , addr : A ) -> io :: Result < ( ) > {
159+ pub async fn connect < A : ToSocketAddrs > ( & self , addr : A ) {
160160 World :: current ( |world| {
161161 let addr = addr. to_socket_addr ( & world. dns ) ;
162162 let host = world. current_host_mut ( ) ;
163163
164- host. udp . connect ( self . local_addr , addr)
164+ host. udp . connect ( self . local_addr , addr) ;
165165 } )
166166 }
167167
Original file line number Diff line number Diff line change @@ -1046,7 +1046,7 @@ fn try_recv_connected() -> Result {
10461046 sim. client ( "server1" , async move {
10471047 let sock = UdpSocket :: bind ( ( Ipv4Addr :: UNSPECIFIED , 1234 ) ) . await ?;
10481048
1049- sock. connect ( ( "server2" , 5678 ) ) . await ? ;
1049+ sock. connect ( ( "server2" , 5678 ) ) . await ;
10501050
10511051 sock. readable ( ) . await ?;
10521052
@@ -1079,7 +1079,7 @@ fn try_recv_connected_wrong_host() -> Result {
10791079 let sock = UdpSocket :: bind ( ( Ipv4Addr :: UNSPECIFIED , 1234 ) ) . await ?;
10801080
10811081 // Connect to server3, which doesn't send anything.
1082- sock. connect ( ( "server3" , 6781 ) ) . await ? ;
1082+ sock. connect ( ( "server3" , 6781 ) ) . await ;
10831083
10841084 // Datagram from server2 is filtered so sock never becomes readable.
10851085 tokio:: time:: timeout ( Duration :: from_secs ( 5 ) , sock. readable ( ) )
You can’t perform that action at this time.
0 commit comments