示例#1
0
void TransportLayerASIO::ASIOSourceTicket::_headerCallback(const std::error_code& ec, size_t size) {
    if (ec) {
        finishFill(errorCodeToStatus(ec));
        return;
    }

    auto session = getSession();
    if (!session)
        return;

    MSGHEADER::View headerView(_buffer.get());
    auto msgLen = static_cast<size_t>(headerView.getMessageLength());
    if (msgLen < kHeaderSize || msgLen > MaxMessageSizeBytes) {
        LOG(0) << "recv(): message msgLen " << msgLen << " is invalid. "
               << "Min " << kHeaderSize << " Max: " << MaxMessageSizeBytes;
        finishFill(errorCodeToStatus(ec));
        return;
    }

    if (msgLen == size) {
        finishFill(Status::OK());
        return;
    }

    _buffer.realloc(msgLen);
    MsgData::View msgView(_buffer.get());

    session->read(isSync(),
                  asio::buffer(msgView.data(), msgView.dataLen()),
                  [this](const std::error_code& ec, size_t size) { _bodyCallback(ec, size); });
}
示例#2
0
QAccessible::State QAccessibleTableHeaderCell::state() const
{
    QAccessible::State s;
    if (QHeaderView *h = headerView()) {
        s.invisible = !h->testAttribute(Qt::WA_WState_Visible);
        s.disabled = !h->isEnabled();
    }
    return s;
}