When marking down connection, previously we will call stop which will dispatch event
regardless of the staus of the connection. If this connection is already down and
its events all has cleaned, we will hit NULL event.
Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
void wakeup_from(uint64_t id);
void local_deliver();
void stop() {
- center->dispatch_event_external(reset_handler);
+ lock.Lock();
+ if (state != STATE_CLOSED)
+ center->dispatch_event_external(reset_handler);
+ lock.Unlock();
mark_down();
}
void cleanup_handler() {
pthread_t cur = pthread_self();
for (vector<Worker*>::iterator it = workers.begin(); it != workers.end(); ++it) {
assert(cur != (*it)->center.get_owner());
- (*it)->center.dispatch_event_external(EventCallbackRef(new C_barrier(this)));
barrier_count.inc();
+ (*it)->center.dispatch_event_external(EventCallbackRef(new C_barrier(this)));
}
ldout(cct, 10) << __func__ << " wait for " << barrier_count.read() << " barrier" << dendl;
Mutex::Locker l(barrier_lock);