Пример #1
0
func (t *senderRoundtripReporter) OnWrite(rtt int64, timeWrite int64) *dccp.Option {
	if rtt <= 0 || timeWrite-t.lastReportTime < rtt {
		return nil
	}
	t.lastReportTime = timeWrite
	return encodeOption(&RoundtripReportOption{Roundtrip: dccp.TenMicroFromNano(rtt)})
}
Пример #2
0
func (r *receiver) makeElapsedTimeOption(ackNo int64, timeWrite int64) *dccp.ElapsedTimeOption {
	// The first Ack may be sent before receiver has had a chance to see a gsr, in which
	// case we return nil
	if r.gsr == 0 {
		return nil
	}
	if ackNo != r.gsr {
		panic("ccid3 receiver: GSR != AckNo")
	}
	elapsedNS := max64(0, timeWrite-r.gsrTimestamp)
	return &dccp.ElapsedTimeOption{dccp.TenMicroFromNano(elapsedNS)}
}