Skip to content

Commit e32b78a

Browse files
authored
Merge pull request #401 from nanblpc/set-idle-when-block-timeout
set st to idle when block timeout
2 parents 334730e + 9c2a4ee commit e32b78a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/braft/replicator.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,13 @@ void Replicator::wait_for_caught_up(ReplicatorId id,
218218
}
219219

220220
void* Replicator::_on_block_timedout_in_new_thread(void* arg) {
221+
Replicator* r = NULL;
222+
bthread_id_t id = { (uint64_t)arg };
223+
if (bthread_id_lock(id, (void**)&r) != 0) {
224+
return NULL;
225+
}
226+
r->_st.st = IDLE;
227+
bthread_id_unlock(id);
221228
Replicator::_continue_sending(arg, ETIMEDOUT);
222229
return NULL;
223230
}

0 commit comments

Comments
 (0)