-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Server Programmability
Looking at the code, there are 4 different ways one can obtain the client associated with the current thread:
- cc() which returns a reference and crashes if there isn't a client.
- Client::currentClient(), which returns a nullptr if the thread doesn't have a client and doesn't crash.
- ThreadClient::get() which returns directly the client held by the ThreadClient object.
- AlternativeClientRegion::get() which returns directly the client held by the AlternativeClientRegion object.
- OperationContext::getClient()
- Directly passing Client* to the function
This looks a bit excessive and confusing and we should probably have one unified way for obtaining the client of the current thread. I have slight preference that we converge on Client::currentClient() as the only way to access the current client.