Преглед на файлове

Taking into account TCP and IP header

The MTU consists of TCP header, IP header and the payload.
In the former fix, this was not taken into account.
mustermeiszer преди 4 години
родител
ревизия
b767861998
променени са 1 файла, в които са добавени 1 реда и са изтрити 1 реда
  1. 1 1
      src/socket/tcp.rs

+ 1 - 1
src/socket/tcp.rs

@@ -1559,7 +1559,7 @@ impl<'a> TcpSocket<'a> {
                 // from the transmit buffer.
                 let offset = self.remote_last_seq - self.local_seq_no;
                 let size = cmp::min(cmp::min(self.remote_win_len, self.remote_mss),
-                     caps.max_transmission_unit);
+                     caps.max_transmission_unit - ip_repr.buffer_len() - repr.mss_header_len());
                 repr.payload = self.tx_buffer.get_allocated(offset, size);
                 // If we've sent everything we had in the buffer, follow it with the PSH or FIN
                 // flags, depending on whether the transmit half of the connection is open.