分片机制的单元测试 手动创建了两个ip报文分片 IP层从链路层获取这两个报文的时候会把它们合并成一个ip报文 这里我们不会继续分发给传输层

而是直接写回 将这个完整的ip报文整个包装 虽然这样在fdbase测试会触发错误(超过了1518),但在channel中并没有这个限制 测试通过 成功合并
This commit is contained in:
impact-eintr
2022-11-28 15:56:21 +08:00
parent cd0d9492a0
commit c7c7374bbd
6 changed files with 28 additions and 9 deletions

View File

@@ -36,7 +36,7 @@ type reassembler struct {
id uint32
size int
mu sync.Mutex
holes []hole
holes []hole // 每个临时ip报文的缓冲区 最大是65535
deleted int
heap fragHeap // 小根堆用来自动排序
done bool
@@ -68,7 +68,7 @@ func (r *reassembler) updateHoles(first, last uint16, more bool) bool {
}
used = true
r.deleted++
r.holes[i].deleted = true
r.holes[i].deleted = true // 当前位置被占用
if first > r.holes[i].first {
r.holes = append(r.holes, hole{r.holes[i].first, first - 1, false})
}