Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/brpc/details/health_check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ bool HealthCheckTask::OnTriggeringTask(timespec* next_abstime) {
_first_time = false;
if (ptr->WaitAndReset(2/*note*/) != 0) {
LOG(INFO) << "Cancel checking " << *ptr;
ptr->AfterHCCompleted();
return false;
}
}
Expand All @@ -210,11 +209,9 @@ bool HealthCheckTask::OnTriggeringTask(timespec* next_abstime) {
if (!ptr->health_check_path().empty()) {
HealthCheckManager::StartCheck(_id, ptr->_health_check_interval_s);
}
ptr->AfterHCCompleted();
return false;
} else if (hc == ESTOP) {
LOG(INFO) << "Cancel checking " << *ptr;
ptr->AfterHCCompleted();
return false;
} else {
RPC_VLOG << "Fail to check " << *ptr
Expand Down
18 changes: 3 additions & 15 deletions src/brpc/socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,6 @@ Socket::Socket(Forbidden f)
, _correlation_id(0)
, _health_check_interval_s(-1)
, _is_hc_related_ref_held(false)
, _hc_started(false)
, _ninprocess(1)
, _auth_flag_error(0)
, _auth_id(INVALID_BTHREAD_ID)
Expand Down Expand Up @@ -744,7 +743,6 @@ int Socket::OnCreated(const SocketOptions& options) {
_health_check_interval_s = options.health_check_interval_s;
_hc_option = options.hc_option;
_is_hc_related_ref_held = false;
_hc_started.store(false, butil::memory_order_relaxed);
_ninprocess.store(1, butil::memory_order_relaxed);
_auth_flag_error.store(0, butil::memory_order_relaxed);
const int rc2 = bthread_id_create(&_auth_id, NULL, NULL);
Expand Down Expand Up @@ -915,19 +913,9 @@ void Socket::OnFailed(int error_code, const std::string& error_text) {
// by Channel to revive never-connected socket when server side
// comes online.
if (HCEnabled()) {
bool expect = false;
if (_hc_started.compare_exchange_strong(expect,
true,
butil::memory_order_relaxed,
butil::memory_order_relaxed)) {
GetOrNewSharedPart()->circuit_breaker.MarkAsBroken();
StartHealthCheck(id(),
GetOrNewSharedPart()->circuit_breaker.isolation_duration_ms());
} else {
// No need to run 2 health checking at the same time.
RPC_VLOG << "There is already a health checking running "
"for SocketId=" << id();
}
GetOrNewSharedPart()->circuit_breaker.MarkAsBroken();
StartHealthCheck(id(),
GetOrNewSharedPart()->circuit_breaker.isolation_duration_ms());
}
// Wake up all threads waiting on EPOLLOUT when closing fd
_epollout_butex->fetch_add(1, butil::memory_order_relaxed);
Expand Down
7 changes: 0 additions & 7 deletions src/brpc/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -430,9 +430,6 @@ friend void DereferenceSocket(Socket*);
// reference which is held on created.
void ReleaseHCRelatedReference();

// After health checking is complete, set _hc_started to false.
void AfterHCCompleted() { _hc_started.store(false, butil::memory_order_relaxed); }

// `user' parameter passed to Create().
SocketUser* user() const { return _user; }

Expand Down Expand Up @@ -886,10 +883,6 @@ friend void DereferenceSocket(Socket*);
// synchronized via _versioned_ref atomic variable.
bool _is_hc_related_ref_held;

// Default: false.
// true, if health checking is started.
butil::atomic<bool> _hc_started;

// +-1 bit-+---31 bit---+
// | flag | counter |
// +-------+------------+
Expand Down
Loading