void CHttpThread::run(){ bool exit = false; do{ const DConnectionTask task = sendingQueue.pop(); if (task->getType() == IConnectionTask::EConnectionTaskType::EXIT) { exit = true; } else if (task->getType() == IConnectionTask::EConnectionTaskType::SENDING) { std::shared_ptr<CSendingTask> sendingTask = std::dynamic_pointer_cast<CSendingTask>(task); sendHttp(sendingTask->getProtocol()); } }while(!exit); }
int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); QMongrel2::Mongrel2 m2("1278389173", "tcp://127.0.0.1:9008", "tcp://127.0.0.1:9009"); Webapp webapp; QObject::connect(&m2, SIGNAL(received(QMongrel2::Request)), &webapp, SLOT(receive(QMongrel2::Request))); QObject::connect(&webapp, SIGNAL(reply(QMongrel2::Response)), &m2, SLOT(sendHttp(QMongrel2::Response))); return a.exec(); }