Beispiel #1
0
uint32_t THeaderProtocol::readMessageBegin(std::string& name,
                                           TMessageType& messageType,
                                           int32_t& seqId) {
  // Read the next frame, and change protocols if needed
  try {
    trans_->resetProtocol();
    resetProtocol();
  } catch (const TApplicationException& ex) {
    writeMessageBegin("", T_EXCEPTION, 0);
    ex.write((TProtocol*)this);
    writeMessageEnd();
    trans_->flush();
  }
  return proto_->readMessageBegin(name, messageType, seqId);
}
uint32_t THeaderProtocol::readMessageBegin(std::string& name,
                                           TMessageType& messageType,
                                           int32_t& seqId) {
  // Read the next frame, and change protocols if needed
  try {
    trans_->resetProtocol();
    resetProtocol();
  } catch (const TApplicationException& ex) {
    writeMessageBegin("", T_EXCEPTION, 0);
    ex.write((TProtocol*)this);
    writeMessageEnd();
    trans_->flush();

    // The framing is still good, but we don't know about this protocol.
    // In the future, this could be made a client-side only error if
    // connection pooling is used.
    throw ex;
  }
  return proto_->readMessageBegin(name, messageType, seqId);
}