ConfigureConnectionLanes: reconfiguring lanes can leave one lane in a stale priority class

未关闭
#453 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

@sebxt 已经在做这个了。

开始于 2026年10月20日。

  • #454 来自 @sebxt —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
cpp
领域
networking

调研方向

Read CSteamNetworkConnectionBase::SNP_ConfigureLanes in steamnetworkingsockets_snp.cpp, focusing on the loop that merges sorted priority classes and assigns m_idxPriorityClass. Reproduce by swapping lane priorities, then check lane status; also try priorities {0, 1, 2} followed by {1, 1, 0} to expose the out-of-bounds case. Done means every lane's class matches the current priorities after each configuration; linked PR #454 is already open.

由索引模型根据 Issue 内容生成。

描述

What happens

The docs for ConfigureConnectionLanes say lanes may be reconfigured at any time. When a connection reconfigures its lanes, the lane with the lowest priority value (the one that sorts first) keeps whatever m_idxPriorityClass it had from the previous configuration. Every other lane gets its class index reassigned.

Swapping priorities on two lanes is enough to see it. Lane 1 should now be strictly ahead of lane 0, but it stays in class 1 next to lane 0. Class 0 ends up with no lanes, and the two lanes share bandwidth by weight instead of by priority.

If the stale index is greater than or equal to the new number of priority classes, m_vecPriorityClasses[ l.m_idxPriorityClass ] in the "Setup each lane" loop reads past the end of the vector. For example: priorities { 0, 1, 2 }, then { 1, 1, 0 }. Lane 2 keeps class 2, but there are now only 2 classes.

What should happen

After every call, each lane's priority class should match the priorities passed to that call.

Minimal repro

// hSender from CreateSocketPair( ..., true, ... ), fixed send rate of 128 KB/s
int prio1[2] = { 0, 1 };
ConfigureConnectionLanes( hSender, 2, prio1, nullptr );
int prio2[2] = { 1, 0 };
ConfigureConnectionLanes( hSender, 2, prio2, nullptr );
// queue 64 KB of unreliable messages on each lane, then:
GetConnectionRealTimeStatus( hSender, &status, 2, laneStatus );

Expected: lane 1 queue time is about 500 ms and lane 0 is about 1000 ms.
Actual: both lanes report 1000 ms, because they are scheduled in the same class.

Root cause

In CSteamNetworkConnectionBase::SNP_ConfigureLanes (steamnetworkingsockets_snp.cpp), the loop that merges sorted priority classes starts at j = 1 and only assigns m_idxPriorityClass for pPriorityClass[j]. The entry at sorted position 0 is never assigned. On the first configuration this goes unnoticed, because a newly created lane defaults to class 0. On a later reconfiguration, that lane may already exist with a nonzero class.

主要语言
C++
星标
10k
派生
767
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

ValveSoftware/GameNetworkingSockets 的其他 Issue

查看 ValveSoftware/GameNetworkingSockets 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。