Method SSL.Connection()->send_packet_1_3()
classSSL.Connection
- Method
send_packet_1_3
voidsend_packet_1_3(Packetpacket,int|voidpriority)- Description
TLS 1.3 and later: queue
packetfor sending, like send_packet(), but additionally bind it (via Packet.bound_write_state) to whatevercurrent_write_stateis *right now*.This matters because send_packet() only queues a packet -- the actual
encrypt_packet()call happens later, whenever to_write() drains the queue. TLS 1.3 rekeys by directly reassigningcurrent_write_stateat fixed protocol points (see new_traffic_state()), potentially several times while a flight of messages for *different* keys is still sitting in the queue (eg ServerHello in the clear, then EncryptedExtensions.. Finished under the handshake traffic secret, all queued before anything is actually drained) -- encrypting everything with whatevercurrent_write_statehappens to be when to_write() is eventually called would encrypt all of them with only the last one. Binding the state at queue time fixes that.