Exemple #1
0
func decode_range_ack_chunk(srcAddr *string, r *bytes.Buffer, handler chunk_handler) {

	flowid := decode_vlu(r)
	bufAvail := decode_vlu(r) * 1024
	cumAck := decode_vlu(r)

	recvRanges := make([]Range, 0)
	ackCursor := cumAck + 1
	for r.Len() > 0 {
		pos := ackCursor + decode_vlu(r) + 1
		len := decode_vlu(r) + 1
		r := MakeRange(pos, pos+len)
		recvRanges = append(recvRanges, r)

		ackCursor = r.End()
	}

	//fmt.Printf("[RangeACK Chunk]flowid:%d  bufAvail:%d  cumAck:%d  recvRanges:%v \n",
	//	flowid, bufAvail, cumAck, RangeQueueFromArray(recvRanges).String())

	if handler != nil {
		handler.recv_range_ack(srcAddr, flowid, bufAvail, cumAck, recvRanges)
	}
}