X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fidentserver.h;fp=src%2Fcore%2Fidentserver.h;h=4d4aecc5185214392b17dc6ffbdd90b40ca8f568;hp=5aa827373790d61a51bda8df762f9e92c7a6a9d2;hb=41b9d689945e784b160a25d12076600ff4b7ae90;hpb=9451580d19875b23ec52af64585496efb7268e0f diff --git a/src/core/identserver.h b/src/core/identserver.h index 5aa82737..4d4aecc5 100644 --- a/src/core/identserver.h +++ b/src/core/identserver.h @@ -25,27 +25,52 @@ #include "coreidentity.h" +struct Request { + QTcpSocket *socket; + uint16_t localPort; + QString query; + qint64 transactionId; + qint64 requestId; + + friend bool operator==(const Request &a, const Request &b); +}; + class IdentServer : public QObject { Q_OBJECT public: IdentServer(bool strict, QObject *parent); - ~IdentServer(); + ~IdentServer() override; bool startListening(); void stopListening(const QString &msg); + qint64 addWaitingSocket(); public slots: - bool addSocket(const CoreIdentity *identity, const QHostAddress &localAddress, quint16 localPort, const QHostAddress &peerAddress, quint16 peerPort); - bool removeSocket(const CoreIdentity *identity, const QHostAddress &localAddress, quint16 localPort, const QHostAddress &peerAddress, quint16 peerPort); + bool addSocket(const CoreIdentity *identity, const QHostAddress &localAddress, quint16 localPort, const QHostAddress &peerAddress, quint16 peerPort, qint64 socketId); + bool removeSocket(const CoreIdentity *identity, const QHostAddress &localAddress, quint16 localPort, const QHostAddress &peerAddress, quint16 peerPort, qint64 socketId); private slots: void incomingConnection(); - void respond(); private: + bool responseAvailable(Request request); + void responseUnavailable(Request request); + + QString sysIdentForIdentity(const CoreIdentity *identity) const; + + bool hasSocketsBelowId(qint64 socketId); + + void processWaiting(qint64 socketId); + + void removeWaitingSocket(qint64 socketId); + QTcpServer _server, _v6server; bool _strict; QHash _connections; + std::list _requestQueue; + std::list _waiting; + qint64 _socketId; + qint64 _requestId; };