QNetworkReply *NetworkAccessManager::createRequest(Operation op, const QNetworkRequest & req, QIODevice * outgoingData = nullptr) { if (req.url().host() != QLatin1String("psi")) { return QNetworkAccessManager::createRequest(op, req, outgoingData); } QNetworkReply *reply = nullptr; QByteArray data; QByteArray mime; for (auto &handler : _pathHandlers) { if (handler->data(req, data, mime)) { reply = new ByteArrayReply(req, data, mime, this); break; } } if (!reply) { QString ua = req.header(QNetworkRequest::UserAgentHeader).toString(); auto handler = _sessionHandlers.value(ua); if (handler && handler->data(req, data, mime)) { reply = new ByteArrayReply(req, data, mime, this); } } if (!reply) { reply = new ByteArrayReply(req); //finishes with error } connect(reply, SIGNAL(finished()), SLOT(callFinished())); return reply; }
void ServiceServerLink::onResponse(const ConnectionPtr& conn, const boost::shared_array<uint8_t>& buffer, uint32_t size, bool success) { ROS_ASSERT(conn == connection_); if (!success) return; { boost::mutex::scoped_lock queue_lock(call_queue_mutex_); if (current_call_->success_) { *current_call_->resp_ = ros::SerializedMessage(buffer, size); } else { current_call_->exception_string_ = std::string(reinterpret_cast<char*>(buffer.get()), size); } } callFinished(); }