func (rb *raftBackend) _stop(shouldCloseStopChan bool) {
	if atomic.CompareAndSwapInt32(&rb.alreadyClosed, int32(0), int32(1)) {
		// stop the raft node
		rb.raftNode.Stop()
		// stop the raft state machine
		if shouldCloseStopChan {
			close(rb.stopChan)
		}

		if rb.commitChan != nil {
			close(rb.commitChan)
		}

		if rb.errorChan != nil {
			close(rb.errorChan)
		}
	}
}
// can be called any number of times
// but will only do work the first time
can be called any number of times
but will only do work the first time
// can be called any number of times // but will only do work the first time
func (rb *raftBackend) _stop(shouldCloseStopChan bool) {
	if atomic.CompareAndSwapInt32(&rb.alreadyClosed, int32(0), int32(1)) {
		rb.raftNode.Stop()
		if shouldCloseStopChan {
			close(rb.stopChan)
		}
		if rb.commitChan != nil {
			close(rb.commitChan)
		}
		if rb.errorChan != nil {
			close(rb.errorChan)
		}
	}
}
func ( rb * raftBackend ) _stop ( shouldCloseStopChan bool ) { if atomic . CompareAndSwapInt32 ( & rb . alreadyClosed , int32 ( 0 ) , int32 ( 1 ) ) { rb . raftNode . Stop ( ) if shouldCloseStopChan { close ( rb . stopChan ) } if rb . commitChan != nil { close ( rb . commitChan ) } if rb . errorChan != nil { close ( rb . errorChan ) } } }
can be called any number of times
but will only do work the first time
can be called any number of times but will only do work the first time
// stop the raft node // stop the raft state machine