Initial side dependent elements handling, initial multi col/row objects support, lousy bugfix about hanging on stopiing a module

This commit is contained in:
Blue 2019-03-23 15:47:05 +03:00
parent 7f03a0bd75
commit 35fcc5c801
13 changed files with 760 additions and 259 deletions

View file

@ -16,10 +16,15 @@
#include <wSocket/socket.h>
#include <wContainer/order.h>
namespace U {
class Connector;
};
namespace C {
class Controller : public QObject
{
Q_OBJECT
friend class U::Connector;
public:
enum ModelType {
string,

View file

@ -43,6 +43,9 @@ U::Connector::~Connector()
ctrl->unregisterController();
}
}
disconnect(server, SIGNAL(newConnection(const W::Socket&)), this, SLOT(onNewConnection(const W::Socket&)));
disconnect(server, SIGNAL(closedConnection(const W::Socket&)), this, SLOT(onClosedConnection(const W::Socket&)));
}
void U::Connector::addIgnoredNode(const W::String& name)
@ -115,7 +118,7 @@ void U::Connector::onClosedConnection(const W::Socket& socket)
std::multimap<W::String, C::Controller*>::const_iterator end = controllers.upper_bound(name);
for (; beg != end; ++beg) {
beg->second->unsubscribe();
beg->second->dropSubscribed();
beg->second->unregisterController();
}

View file

@ -110,6 +110,10 @@ W::Socket * W::Server::createSocket(QWebSocket* socket)
}
Socket *wSocket = new Socket(name, socket, connectionId, this);
if (connections.find(connectionId) != connections.end()) {
throw new SocketIdDuplectation(connectionId);
}
connections[connectionId] = wSocket;
connect(wSocket, SIGNAL(connected()), SLOT(onSocketConnected()));
connect(wSocket, SIGNAL(disconnected()), SLOT(onSocketDisconnected()));

View file

@ -73,6 +73,16 @@ namespace W
std::string getMessage() const{return "An attempt to access non existing socket";}
};
class SocketIdDuplectation:
public Utils::Exception
{
public:
SocketIdDuplectation(uint64_t p_id):Exception(),id(p_id){}
uint64_t id;
std::string getMessage() const{return "An attempt to create a socket with duplicating id == " + std::to_string(id);}
};
};
}

View file

@ -106,8 +106,10 @@ void W::Socket::onSocketConnected()
void W::Socket::onSocketDisconnected()
{
state = disconnected_s;
emit disconnected();
if (state != disconnected_s) {
state = disconnected_s;
emit disconnected();
}
}
void W::Socket::onBinaryMessageReceived(const QByteArray& ba)