void GateModule::handle_message(const message& msg) { switch (msg.get_type()) { case EMessageType::SocketConnect: { ClientConnect(msg); break; } case EMessageType::SocketData: { ClientData(msg); break; } case EMessageType::SocketClose: { ClientClose(msg); break; } case EMessageType::ActorData: { ActorData(msg); break; } case EMessageType::ToClient: { ToClientData(msg); break; } } }
void ClipboardServer::onClientNewConnection(const ClientSocketPtr &client) { if (m_ignoreNewConnections) { COPYQ_LOG("Ignoring new client while exiting"); client->close(); return; } auto proxy = new ScriptableProxy(m_wnd); connect( client.get(), &ClientSocket::destroyed, proxy, &ScriptableProxy::safeDeleteLater ); connect( proxy, &ScriptableProxy::sendMessage, client.get(), &ClientSocket::sendMessage ); m_clients.insert( client->id(), ClientData(client, proxy) ); connect( this, &ClipboardServer::closeClients, client.get(), &ClientSocket::close ); connect( client.get(), &ClientSocket::messageReceived, this, &ClipboardServer::onClientMessageReceived ); connect( client.get(), &ClientSocket::disconnected, this, &ClipboardServer::onClientDisconnected ); connect( client.get(), &ClientSocket::disconnected, proxy, &ScriptableProxy::clientDisconnected ); connect( client.get(), &ClientSocket::connectionFailed, this, &ClipboardServer::onClientConnectionFailed ); client->start(); }