func (w *watcher) AddPendingRequest(handle *protocol.RequestHandle) { // Mutex for protecting the following go-routine: // 1) Commit / LogProposal / Respond / Abort // 2) CleanupOnClose / CleaupOnTimeout / CleanupOnError w.mutex.Lock() defer w.mutex.Unlock() if w.isClosed { w.signalError(handle, "Terminate Request during cleanup") return } // remember the request handle.StartTime = time.Now().UnixNano() w.pendingReqs[handle.Request.GetReqId()] = handle }