/// <summary> /// Handle an ANP event received from the KCD. /// </summary> public void HandleKcdEvent(AnpMsg msg) { KLogging.Log("HandleAnpEvent() in kws " + m_kws.InternalID + ", status " + m_cd.MainStatus); // This is a permanent event. if (msg.ID > 0) { // Logic problem detected. if (msg.ID < m_ks.LastReceivedEventId) { BlameKcd(new Exception("received ANP event with bogus ID")); return; } // Store the event in the database. Mark it as unprocessed. m_kws.StoreKAnpEventInDb(msg, KwsAnpEventStatus.Unprocessed); // Update the information about the events. m_ks.NbUnprocessedEvent++; m_ks.LastReceivedEventId = msg.ID; m_kws.OnStateChange(WmStateChange.Permanent); } // If this is a transient event or the only unprocessed event, // dispatch it right away if possible. This is done so that single // incoming events are processed very quickly instead of waiting // for a future workspace state machine run. if (msg.ID == 0 || (m_ks.NbUnprocessedEvent == 1 && !WmKcdState.QuenchFlag && m_kws.IsOfflineCapable())) { DispatchKcdEvent(msg); } }