During the destruction of NearbyConnections, Core (which owns ClientProxy) is destructed before ServiceController (which owns EndpointManager), which means any pending tasks on the EndpointManager executor that use ClientProxy will be using
garbage memory. To fix this issue, EndpointManager::DiscardEndpoint will check
for an `is_shutdown` boolean set during ~EndpointManager before accessing
ClientProxy. The assumption is that any accessing of ClientProxy after the
destruction will be invalid.
PiperOrigin-RevId: 532581122
The flow below caused a dead-lock:
1. A lengthy task A is running on an executor.
2. Executor is destructed, or `Shutdown()` on another thread. The call blocks
waiting for A to complete.
3. Task A executes another task B on the executor. The call blocks forever.
PiperOrigin-RevId: 517495348