@@ -30,7 +30,7 @@ pub enum SendError {
3030 /// Socket not bound to an outgoing port.
3131 SocketNotBound ,
3232 /// There is not enough transmit buffer capacity to ever send this packet.
33- Truncated ,
33+ PacketTooLarge ,
3434}
3535
3636/// Error returned by [`UdpSocket::recv_from`].
@@ -252,11 +252,9 @@ impl<'a> UdpSocket<'a> {
252252 T : Into < UdpMetadata > ,
253253 {
254254 // Don't need to wake waker in `with_mut` if the buffer will never fit the udp tx_buffer.
255- let send_capacity_too_small = self
256- . stack
257- . with ( |i| i. sockets . get :: < udp:: Socket > ( self . handle ) . payload_send_capacity ( ) < buf. len ( ) ) ;
255+ let send_capacity_too_small = self . with ( |s, _| s. payload_send_capacity ( ) < buf. len ( ) ) ;
258256 if send_capacity_too_small {
259- return Poll :: Ready ( Err ( SendError :: Truncated ) ) ;
257+ return Poll :: Ready ( Err ( SendError :: PacketTooLarge ) ) ;
260258 }
261259
262260 self . with_mut ( |s, _| match s. send_slice ( buf, remote_endpoint) {
@@ -291,11 +289,9 @@ impl<'a> UdpSocket<'a> {
291289 F : FnOnce ( & mut [ u8 ] ) -> R ,
292290 {
293291 // Don't need to wake waker in `with_mut` if the buffer will never fit the udp tx_buffer.
294- let send_capacity_too_small = self
295- . stack
296- . with ( |i| i. sockets . get :: < udp:: Socket > ( self . handle ) . payload_send_capacity ( ) < size) ;
292+ let send_capacity_too_small = self . with ( |s, _| s. payload_send_capacity ( ) < size) ;
297293 if send_capacity_too_small {
298- return Err ( SendError :: Truncated ) ;
294+ return Err ( SendError :: PacketTooLarge ) ;
299295 }
300296
301297 let mut f = Some ( f) ;
0 commit comments