send DelayTime in ACK frames

fixes #81
This commit is contained in:
Marten Seemann
2016-05-12 17:43:48 +07:00
parent 2f6e2c1201
commit 3683763dc0
8 changed files with 71 additions and 25 deletions

View File

@@ -15,9 +15,11 @@ var errInvalidNackRanges = errors.New("AckFrame: ACK frame contains invalid NACK
type AckFrame struct {
LargestObserved protocol.PacketNumber
Entropy byte
DelayTime time.Duration
NackRanges []NackRange // has to be ordered. The NACK range with the highest FirstPacketNumber goes first, the NACK range with the lowest FirstPacketNumber goes last
Truncated bool
DelayTime time.Duration
PacketReceivedTime time.Time // only for received packets. Will not be modified for received ACKs frames
}
// Write writes an ACK frame.
@@ -28,6 +30,8 @@ func (f *AckFrame) Write(b *bytes.Buffer, version protocol.VersionNumber) error
typeByte |= (0x20 | 0x03)
}
f.DelayTime = time.Now().Sub(f.PacketReceivedTime)
b.WriteByte(typeByte)
b.WriteByte(f.Entropy)
utils.WriteUint48(b, uint64(f.LargestObserved)) // TODO: send the correct length