Skip to content

fix(ws): guard client config updates#215

Open
Zhang-986 wants to merge 1 commit into
larksuite:v3_mainfrom
Zhang-986:codex/ws-client-config-race
Open

fix(ws): guard client config updates#215
Zhang-986 wants to merge 1 commit into
larksuite:v3_mainfrom
Zhang-986:codex/ws-client-config-race

Conversation

@Zhang-986

Copy link
Copy Markdown

Summary

  • add a dedicated config mutex for WebSocket client config updated by configure
  • read ping/reconnect settings through snapshots before using them from background loops
  • snapshot connection state before pingLoop reads serviceID, without holding the connection mutex while writing to the socket

This intentionally does not reuse the existing c.mu for configure: connect holds c.mu while calling getConnURL, and getConnURL can call configure when the bootstrap endpoint returns ClientConfig. Reusing c.mu there would risk deadlocking that path.

Fixes #188
Fixes #189

Tests

  • go test -race ./ws -run TestPingLoopConfigureRace -count=1
  • go test -race ./ws -count=1
  • go test ./ws -count=1
  • go test ./... -count=1
  • git diff --check

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

Labels

None yet

Projects

None yet

1 participant