Adds immediate migration results in progress
This commit is contained in:
2102 files changed
+17482
-15071
No files matched your search
+7
-7
@@ -30,7 +30,7 @@ bool ClientConnection::init()
|
||||
{
|
||||
if (m_socket == nullptr)
|
||||
{
|
||||
ERROR_LOG() << "Initialisation failed due to an invalid socket";
|
||||
ERROR_LOG(m_logger) << "Initialisation failed due to an invalid socket";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -51,17 +51,17 @@ void ClientConnection::addMessage(const CombatNetRadio::WebSocketInterface::Mess
|
||||
if (!m_socket || m_socket->state() != QAbstractSocket::ConnectedState)
|
||||
{
|
||||
m_messageQueue.enqueue(message);
|
||||
DEBUG_LOG() << "Adding message to queue, size: " << m_messageQueue.size();
|
||||
DEBUG_LOG(m_logger) << "Adding message to queue, size: " << m_messageQueue.size();
|
||||
return;
|
||||
}
|
||||
const QString msg(message.toJsonString());
|
||||
DEBUG_LOG() << "Send msg: " << msg;
|
||||
DEBUG_LOG(m_logger) << "Send msg: " << msg;
|
||||
m_socket->sendTextMessage(msg);
|
||||
}
|
||||
|
||||
void ClientConnection::onNewTextMessageFromSocket(const QString &message)
|
||||
{
|
||||
DEBUG_LOG() << "Recv msg: " << message;
|
||||
DEBUG_LOG(m_logger) << "Recv msg: " << message;
|
||||
emit newTextMessage(this, message);
|
||||
}
|
||||
|
||||
@@ -73,15 +73,15 @@ void ClientConnection::sendMessagesFromQueue()
|
||||
{
|
||||
Messages::ReplyMessage message = m_messageQueue.dequeue();
|
||||
const QString msg(message.toJsonString());
|
||||
TRACE_LOG() << "Send msg: " << msg;
|
||||
TRACE_LOG(m_logger) << "Send msg: " << msg;
|
||||
m_socket->sendTextMessage(msg);
|
||||
DEBUG_LOG() << "Sent message from queue, new size: " << m_messageQueue.size();
|
||||
DEBUG_LOG(m_logger) << "Sent message from queue, new size: " << m_messageQueue.size();
|
||||
}
|
||||
}
|
||||
|
||||
void ClientConnection::onSocketDisconnect()
|
||||
{
|
||||
DEBUG_LOG() << "Client with ip "
|
||||
DEBUG_LOG(m_logger) << "Client with ip "
|
||||
<< m_ip.toString()
|
||||
<< " disconnected";
|
||||
emit disconnected(this);
|
||||
|
||||
+2
@@ -40,9 +40,11 @@ private Q_SLOTS:
|
||||
void onSocketDisconnect();
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
void sendMessages();
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
QWebSocket *m_socket;
|
||||
QQueue<Messages::ReplyMessage> m_messageQueue;
|
||||
QHostAddress m_ip;
|
||||
|
||||
+8
-9
@@ -10,9 +10,8 @@
|
||||
|
||||
using namespace CombatNetRadio::WebSocketInterface::Connection;
|
||||
|
||||
ConnectionHandler::ConnectionHandler()
|
||||
: m_server(nullptr)
|
||||
{
|
||||
ConnectionHandler::ConnectionHandler() : m_server(nullptr),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
|
||||
}
|
||||
|
||||
ConnectionHandler::~ConnectionHandler()
|
||||
@@ -38,13 +37,13 @@ bool ConnectionHandler::init()
|
||||
|
||||
|
||||
quint16 port = 2081;
|
||||
DEBUG_LOG() << "Trying to listen to port " << port;
|
||||
DEBUG_LOG(m_logger) << "Trying to listen to port " << port;
|
||||
if (!m_server->listen(QHostAddress::Any, port))
|
||||
{
|
||||
ERROR_LOG() << "Not possible to listen to port " << port;
|
||||
ERROR_LOG(m_logger) << "Not possible to listen to port " << port;
|
||||
return false;
|
||||
}
|
||||
DEBUG_LOG() << "... ok";
|
||||
DEBUG_LOG(m_logger) << "... ok";
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -63,7 +62,7 @@ void ConnectionHandler::onNewMessage(CombatNetRadio::WebSocketInterface::Message
|
||||
|
||||
void ConnectionHandler::onServerError(QWebSocketProtocol::CloseCode closeCode)
|
||||
{
|
||||
ERROR_LOG() << "Got server error with close code " << closeCode;
|
||||
ERROR_LOG(m_logger) << "Got server error with close code " << closeCode;
|
||||
}
|
||||
|
||||
void ConnectionHandler::onNewConnection()
|
||||
@@ -75,7 +74,7 @@ void ConnectionHandler::onNewConnection()
|
||||
|
||||
if (!newConnection->init())
|
||||
{
|
||||
ERROR_LOG() << "Failed to initialise new client";
|
||||
ERROR_LOG(m_logger) << "Failed to initialise new client";
|
||||
delete newConnection;
|
||||
newConnection = nullptr;
|
||||
continue;
|
||||
@@ -85,7 +84,7 @@ void ConnectionHandler::onNewConnection()
|
||||
connect(newConnection, &ClientConnection::disconnected, this, &ConnectionHandler::onDisconnected);
|
||||
|
||||
m_connections.append(newConnection);
|
||||
DEBUG_LOG() << "New client with ip " << newConnection->ip().toString() << " connected";
|
||||
DEBUG_LOG(m_logger) << "New client with ip " << newConnection->ip().toString() << " connected";
|
||||
emit newClientConnection((qint64) static_cast<WebSocketInterface::Connection::ClientConnection::MessageTransmitter*>(newConnection));
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -50,6 +50,7 @@ private Q_SLOTS:
|
||||
void onDisconnected(ClientConnection *conn);
|
||||
|
||||
private:
|
||||
NGL::INGLLogger &m_logger;
|
||||
QWebSocketServer *m_server;
|
||||
QVector<ClientConnection *> m_connections;
|
||||
};
|
||||
|
||||
+2
-3
@@ -12,9 +12,8 @@ namespace WebSocketInterface
|
||||
namespace Messages
|
||||
{
|
||||
|
||||
MessageHandler::MessageHandler(ExerciseManager *exerciseManager)
|
||||
: m_exerciseManager(exerciseManager)
|
||||
{
|
||||
MessageHandler::MessageHandler(ExerciseManager *exerciseManager) : m_exerciseManager(exerciseManager),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
|
||||
Q_ASSERT(exerciseManager);
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -28,6 +28,8 @@ public Q_SLOTS:
|
||||
void onNewTextMessage(MessageTransmitter *transmitter, const QString &message);
|
||||
|
||||
private:
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
ExerciseManager *m_exerciseManager;
|
||||
};
|
||||
}
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ bool WebSocketInterfaceHandler::init()
|
||||
|
||||
if (!m_connectionHandler->init())
|
||||
{
|
||||
ERROR_LOG() << "Failed to initialise ConnectionHandler";
|
||||
ERROR_LOG(m_logger) << "Failed to initialise ConnectionHandler";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user