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); }); }
void TransportLayerASIO::ASIOSinkTicket::fillImpl() { auto session = getSession(); if (!session) return; session->write(isSync(), asio::buffer(_msgToSend.buf(), _msgToSend.size()), [this](const std::error_code& ec, size_t size) { _sinkCallback(ec, size); }); }
void HTMLImportChild::showThis() { bool isFirst = loader() ? loader()->isFirstImport(this) : false; HTMLImport::showThis(); fprintf(stderr, " loader=%p first=%d, sync=%s url=%s", m_loader.get(), isFirst, isSync() ? "Y" : "N", url().string().utf8().data()); }
void TransportLayerASIO::ASIOSourceTicket::fillImpl() { auto session = getSession(); if (!session) return; const auto initBufSize = kHeaderSize; _buffer = SharedBuffer::allocate(initBufSize); session->read(isSync(), asio::buffer(_buffer.get(), initBufSize), [this](const std::error_code& ec, size_t size) { _headerCallback(ec, size); }); }
static bool processSync(pulseProcessor_t *state, unsigned int timestamp, unsigned int width, pulseProcessorResult_t angles[], int *baseStation, int *axis) { bool anglesMeasured = false; if (isNewSync(timestamp, state->lastSync)) { if (isSync(state, timestamp, width)) { anglesMeasured = processPreviousFrame(state, angles, baseStation, axis); storeSyncData(state, timestamp, width); } else { // Expected a sync but something is wrong, re-synchronize. resetSynchronization(state); } } return anglesMeasured; }
void CustomElementMicrotaskImportStep::show(unsigned indent) { fprintf(stderr, "%*sImport(wait=%d sync=%d, url=%s)\n", indent, "", shouldWaitForImport(), m_import && m_import->isSync(), m_import ? m_import->url().string().utf8().data() : "null"); m_queue->show(indent + 1); }