Ver Fonte

tcp: Wake tx waker after abort()

It is useful to wake once the RST packet has been emitted, so
async callers can wait before dropping the socket.
Matt Johnston há 2 anos atrás
pai
commit
7e12265f00
1 ficheiros alterados com 5 adições e 0 exclusões
  1. 5 0
      src/socket/tcp.rs

+ 5 - 0
src/socket/tcp.rs

@@ -2231,6 +2231,11 @@ impl<'a> Socket<'a> {
         if self.state == State::Closed {
             // When aborting a connection, forget about it after sending a single RST packet.
             self.tuple = None;
+            #[cfg(feature = "async")]
+            {
+                // Wake tx now so that async users can wait for the RST to be sent
+                self.tx_waker.wake();
+            }
         }
 
         Ok(())