Skip to content

zblue: Treat -EALREADY as success for ACL connection reply#540

Open
zhongzhijie1 wants to merge 1 commit intoopen-vela:devfrom
zhongzhijie1:app_reply_dup
Open

zblue: Treat -EALREADY as success for ACL connection reply#540
zhongzhijie1 wants to merge 1 commit intoopen-vela:devfrom
zhongzhijie1:app_reply_dup

Conversation

@zhongzhijie1
Copy link
Copy Markdown
Contributor

@zhongzhijie1 zhongzhijie1 commented Mar 23, 2026

depends-on: [open-vela/external_zblue/pull/205]

bug: v/81923

zblue now returns -EALREADY when ACL connection reply is sent more
than once. SAL layer should not log error for this expected case.

Signed-off-by: zhongzhijie1 [email protected]

bug: v/81923

zblue now returns -EALREADY when ACL connection reply is sent more
than once. SAL layer should not log error for this expected case.

Signed-off-by: zhongzhijie1 <[email protected]>
Copy link
Copy Markdown
Contributor

@chengkai15 chengkai15 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR #540 Review — Treat -EALREADY as success for ACL connection reply

depends on: open-vela/external_zblue/pull/205

✅ 改动分析:

  • 原来用 SAL_CHECK(bt_conn_accept_acl_conn(conn), 0) — 任何非零都报错
  • 现在改为显式检查 ret != -EALREADY 才打 error log
  • -EALREADY 是预期行为(多 app 重复 accept/reject),不应当 error

✅ PR #205 + #540 链路完整性:

  • PR #205:底层返回 -EALREADY 标识重复回复
  • PR #540:SAL 层识别 -EALREADY 并静默跳过
  • 两层配合,既保证了 HCI 命令不重复发送,又不产生误报 error log

⚠️ 一个细节:

if (ret && ret != -EALREADY)
    BT_LOGE("%s, accept return:%d", __func__, ret);

这里的条件判断是 ret && ret != -EALREADY,即:

  • ret == 0:首次成功,不打 log(正确)
  • ret == -EALREADY:重复回复被跳过,不打 log(正确,预期行为)
  • ret == 其他负值:真正的错误,打 error log(正确)

逻辑完全正确。

整体评价:✅ LGTM — 和 PR #205 配合完美,修复链路完整。

@chengkai15
Copy link
Copy Markdown
Contributor

@zhongzhijie1 Review 已完成,和 PR #205 配合完整。请确认 comments,确认后我会通知 owner 进行二次 review。

Copy link
Copy Markdown
Contributor

@chengkai15 chengkai15 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR #540 Review — Treat -EALREADY as success for ACL connection reply

概述: 1 文件 10+/3-,zblue 返回 -EALREADY 时不再记录错误日志。依赖 external_zblue/pull/205。

✅ 优点

  • 根因准确:重复 accept/reject 返回 -EALREADY 是预期行为,不是错误
  • 修复正确:仅在 ret 非 0 且非 -EALREADY 时记录错误
  • 影响最小

⚠️ 关注

  • 依赖 external_zblue/pull/205,需确认上游已合并
  • 建议:-EALREADY 情况用 BT_LOGD 或 BT_LOGW 记录,便于排查重复调用来源

📋 结论

修复正确。APPROVE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants