Quellcode durchsuchen

Keep a hybrid responder's reassembled msg1 rather than a copy of it

JackDoan vor 6 Tagen
Ursprung
Commit
a3dc54b012
1 geänderte Dateien mit 3 neuen und 2 gelöschten Zeilen
  1. 3 2
      handshake_manager_hybrid.go

+ 3 - 2
handshake_manager_hybrid.go

@@ -145,8 +145,9 @@ func (hm *HandshakeManager) awaitMsg3(via ViaSender, hh *HandshakeHostInfo, mach
 	now := time.Now()
 	hostinfo.vpnAddrs = vpnAddrs
 	hostinfo.remoteIndexId = rh.RemoteIndex
-	// packet aliases the listener's incoming buffer, so this copy must stay.
-	hostinfo.HandshakePacket[handshakePacketStage0] = append([]byte(nil), packet[header.Len:]...)
+	// A hybrid msg1 is always fragmented, so packet is the one the fragment
+	// table reassembled, not the listener's buffer, and nothing else holds it.
+	hostinfo.HandshakePacket[handshakePacketStage0] = packet[header.Len:]
 	hostinfo.HandshakePacket[handshakePacketStage2] = response
 	hostinfo.remotes = f.lightHouse.QueryCache(vpnAddrs)
 	if !via.IsRelayed {