| 885 | } |
| 886 | |
| 887 | void Socket::OnFailed(int error_code, const std::string& error_text) { |
| 888 | // Update _error_text |
| 889 | pthread_mutex_lock(&_id_wait_list_mutex); |
| 890 | _error_code = error_code; |
| 891 | _error_text = error_text; |
| 892 | pthread_mutex_unlock(&_id_wait_list_mutex); |
| 893 | |
| 894 | // Do health-checking even if we're not connected before, needed |
| 895 | // by Channel to revive never-connected socket when server side |
| 896 | // comes online. |
| 897 | if (HCEnabled()) { |
| 898 | GetOrNewSharedPart()->circuit_breaker.MarkAsBroken(); |
| 899 | StartHealthCheck(id(), GetOrNewSharedPart()->circuit_breaker.isolation_duration_ms()); |
| 900 | } |
| 901 | // Wake up all threads waiting on EPOLLOUT when closing fd |
| 902 | _epollout_butex->fetch_add(1, butil::memory_order_relaxed); |
| 903 | bthread::butex_wake_all(_epollout_butex); |
| 904 | |
| 905 | // Wake up all unresponded RPC. |
| 906 | CHECK_EQ(0, bthread_id_list_reset2_pthreadsafe( |
| 907 | &_id_wait_list, error_code, error_text, |
| 908 | &_id_wait_list_mutex)); |
| 909 | ResetAllStreams(error_code, error_text); |
| 910 | // _app_connect shouldn't be set to NULL in SetFailed otherwise |
| 911 | // HC is always not supported. |
| 912 | // FIXME: Design a better interface for AppConnect |
| 913 | // if (_app_connect) { |
| 914 | // AppConnect* const saved_app_connect = _app_connect; |
| 915 | // _app_connect = NULL; |
| 916 | // saved_app_connect->StopConnect(this); |
| 917 | // } |
| 918 | } |
| 919 | |
| 920 | void Socket::AfterRevived() { |
| 921 | if (_user) { |
nothing calls this directly
no test coverage detected