public ecProto.ecPacket HandlePacket(ecProto.ecPacket p) { ecProto.ecPacket reply = null; switch (m_state) { case REQ_STATE.IDLE: throw new Exception("Should not get packet in IDLE state"); case REQ_STATE.REQ_SENT: m_state = REQ_STATE.IDLE; if (!Phase1Done()) { break; } ecProto.ecPacket full_request = new ecProto.ecPacket(m_req_cmd); ProcessUpdate(p, full_request); // // Phase 3: request full info about files we don't have yet if (!m_inc_tags && (full_request.SubtagCount() != 0)) { reply = full_request; m_state = REQ_STATE.FULL_REQ_SENT; } break; case REQ_STATE.FULL_REQ_SENT: m_state = REQ_STATE.IDLE; break; } return(reply); }
public ecProto.ecPacket ReQuery() { // can not issue new query until previous one is replied if (m_state != REQ_STATE.IDLE) { return(null); } ecProto.ecPacket request = new ecProto.ecPacket(m_req_cmd, m_inc_tags ? EC_DETAIL_LEVEL.EC_DETAIL_INC_UPDATE : EC_DETAIL_LEVEL.EC_DETAIL_UPDATE); m_state = REQ_STATE.REQ_SENT; return(request); }