darion-yaphet opened a new pull request, #3433:
URL: https://github.com/apache/brpc/pull/3433
### What problem does this PR solve?
Issue Number: N/A
Problem Summary:
Reinitializing a Channel could leave stale SocketMap references because
each successful direct initialization inserted a socket entry, while
destruction released only the final derived key. Failed reinitialization could
also partially overwrite the active Channel configuration.
### What is changed and the side effects?
Changed:
- Preserve the exact SocketMapKey for the active single-server Channel.
- Release the previous socket-map reference only after a new
initialization succeeds.
- Build initialization state locally before committing it to Channel.
- Keep the prior Channel state intact when reinitialization fails.
- Add regression tests for repeated direct initialization and failed
reinitialization.
Side effects:
- Reinitializing a Channel now correctly replaces direct-server state and
releases obsolete socket references.
- Channel::Init() remains non-thread-safe; callers must not reinitialize
while RPCs are in flight.
- Performance effects: One small allocation is added per active
single-server Channel to retain its exact socket-map key. Initialization is not
on the RPC hot path.
- Breaking backward compatibility: None intended. Reinitialization remains
supported and now has correct resource lifecycle behavior.
———
### Check List:
- [x] Changes compile with the project C++14 configuration.
- [x] Added focused regression tests.
- [x] Ran relevant ChannelTest cases successfully.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]