Adds immediate migration results in progress
This commit is contained in:
2102 files changed
+17482
-15071
No files matched your search
+7
-7
@@ -36,7 +36,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;
|
||||
}
|
||||
|
||||
@@ -57,17 +57,17 @@ void ClientConnection::addMessage(const WarehouseGuez::WsBiteInterface::Messages
|
||||
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());
|
||||
TRACE_LOG() << "Send msg: " << msg;
|
||||
TRACE_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);
|
||||
}
|
||||
|
||||
@@ -79,15 +79,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
@@ -46,6 +46,8 @@ private Q_SLOTS:
|
||||
void onSocketDisconnect();
|
||||
|
||||
private: // methods
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
void sendMessages();
|
||||
|
||||
private: // attributes
|
||||
|
||||
+8
-9
@@ -19,9 +19,8 @@
|
||||
|
||||
using namespace WarehouseGuez::WsBiteInterface::Connection;
|
||||
|
||||
ConnectionHandler::ConnectionHandler()
|
||||
: m_server(nullptr)
|
||||
{
|
||||
ConnectionHandler::ConnectionHandler() : m_server(nullptr),
|
||||
m_logger(NGL::NGLLoggerBootstrap::getLogger()) {
|
||||
}
|
||||
|
||||
ConnectionHandler::~ConnectionHandler()
|
||||
@@ -48,13 +47,13 @@ bool ConnectionHandler::init()
|
||||
// TODO: read port from config?
|
||||
int port = NGL::Connections::port(NGL::Connections::eConnection::LVS);
|
||||
|
||||
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 - port: " << port;
|
||||
DEBUG_LOG(m_logger) << "... ok - port: " << port;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -66,7 +65,7 @@ void ConnectionHandler::onNewMessage(WarehouseGuez::WsBiteInterface::Messages::M
|
||||
|
||||
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()
|
||||
@@ -78,7 +77,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;
|
||||
@@ -88,7 +87,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";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -50,6 +50,8 @@ private Q_SLOTS:
|
||||
void onDisconnected(ClientConnection *conn);
|
||||
|
||||
private: // attributes
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
QWebSocketServer *m_server;
|
||||
QVector<ClientConnection *> m_connections;
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user