1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-10-31 15:07:12 -04:00

Web API: HTTP server: reduce debug message and put more interesting information

This commit is contained in:
f4exb 2018-08-11 23:29:38 +02:00
parent a0a23d3d73
commit b1b6b74681

View File

@ -97,7 +97,9 @@ void HttpConnectionHandler::createSocket()
void HttpConnectionHandler::run() void HttpConnectionHandler::run()
{ {
#ifdef SUPERVERBOSE
qDebug("HttpConnectionHandler (%p): thread started", this); qDebug("HttpConnectionHandler (%p): thread started", this);
#endif
try try
{ {
exec(); exec();
@ -109,13 +111,17 @@ void HttpConnectionHandler::run()
socket->close(); socket->close();
delete socket; delete socket;
readTimer.stop(); readTimer.stop();
#ifdef SUPERVERBOSE
qDebug("HttpConnectionHandler (%p): thread stopped", this); qDebug("HttpConnectionHandler (%p): thread stopped", this);
#endif
} }
void HttpConnectionHandler::handleConnection(tSocketDescriptor socketDescriptor) void HttpConnectionHandler::handleConnection(tSocketDescriptor socketDescriptor)
{ {
#ifdef SUPERVERBOSE
qDebug("HttpConnectionHandler (%p): handle new connection", this); qDebug("HttpConnectionHandler (%p): handle new connection", this);
#endif
busy = true; busy = true;
Q_ASSERT(socket->isOpen()==false); // if not, then the handler is already busy Q_ASSERT(socket->isOpen()==false); // if not, then the handler is already busy
@ -228,7 +234,11 @@ void HttpConnectionHandler::read()
if (currentRequest->getStatus()==HttpRequest::complete) if (currentRequest->getStatus()==HttpRequest::complete)
{ {
readTimer.stop(); readTimer.stop();
qDebug("HttpConnectionHandler (%p): received request",this); qDebug("HttpConnectionHandler (%p) received request from %s (%s) %s",
this,
qPrintable(currentRequest->getPeerAddress().toString()),
currentRequest->getMethod().toStdString().c_str(),
currentRequest->getPath().toStdString().c_str());
// Copy the Connection:close header to the response // Copy the Connection:close header to the response
HttpResponse response(socket); HttpResponse response(socket);
@ -266,7 +276,9 @@ void HttpConnectionHandler::read()
response.write(QByteArray(),true); response.write(QByteArray(),true);
} }
#ifdef SUPERVERBOSE
qDebug("HttpConnectionHandler (%p): finished request",this); qDebug("HttpConnectionHandler (%p): finished request",this);
#endif
// Find out whether the connection must be closed // Find out whether the connection must be closed
if (!closeConnection) if (!closeConnection)