瀏覽代碼

Use a more specific log message for keep-alive or probe TCP packets.

whitequark 7 年之前
父節點
當前提交
3347bbe60b
共有 1 個文件被更改,包括 8 次插入3 次删除
  1. 8 3
      src/socket/tcp.rs

+ 8 - 3
src/socket/tcp.rs

@@ -907,8 +907,13 @@ impl<'a> TcpSocket<'a> {
                     segment_in_window = false;
                 }
 
-                if !((window_start <= segment_start && segment_start <= window_end) &&
-                     (window_start <= segment_end   && segment_end <= window_end)) {
+                if segment_start == segment_end && segment_end == window_start - 1 {
+                    net_debug!("{}:{}:{}: received a keep-alive or window probe packet, \
+                                will send an ACK",
+                               self.meta.handle, self.local_endpoint, self.remote_endpoint);
+                    segment_in_window = false;
+                } else if !((window_start <= segment_start && segment_start <= window_end) &&
+                            (window_start <= segment_end   && segment_end <= window_end)) {
                     net_debug!("{}:{}:{}: segment not in receive window \
                                 ({}..{} not intersecting {}..{}), will send challenge ACK",
                                self.meta.handle, self.local_endpoint, self.remote_endpoint,
@@ -1166,7 +1171,7 @@ impl<'a> TcpSocket<'a> {
             // Note that we change the transmitter state here.
             // This is fine because smoltcp assumes that it can always transmit zero or one
             // packets for every packet it receives.
-            net_trace!("{}:{}:{}: acknowledging incoming segment",
+            net_trace!("{}:{}:{}: ACKing incoming segment",
                        self.meta.handle, self.local_endpoint, self.remote_endpoint);
             self.remote_last_ack = Some(self.remote_seq_no + self.rx_buffer.len());
             Ok(Some(self.ack_reply(ip_repr, &repr)))