File indexing completed on 2026-04-17 08:35:02
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #ifndef _THRIFT_TASYNC_QTCP_SERVER_H_
0021 #define _THRIFT_TASYNC_QTCP_SERVER_H_
0022
0023 #include <QObject>
0024 #include <QTcpServer>
0025
0026 #include <memory>
0027
0028 namespace apache {
0029 namespace thrift {
0030 namespace protocol {
0031 class TProtocolFactory;
0032 }
0033 }
0034 }
0035
0036 namespace apache {
0037 namespace thrift {
0038 namespace async {
0039
0040 class TAsyncProcessor;
0041
0042
0043
0044
0045
0046
0047 class TQTcpServer : public QObject {
0048 Q_OBJECT
0049 public:
0050 TQTcpServer(std::shared_ptr<QTcpServer> server,
0051 std::shared_ptr<TAsyncProcessor> processor,
0052 std::shared_ptr<apache::thrift::protocol::TProtocolFactory> protocolFactory,
0053 QObject* parent = nullptr);
0054 ~TQTcpServer() override;
0055
0056 private Q_SLOTS:
0057 void processIncoming();
0058 void beginDecode();
0059 void socketClosed();
0060 void deleteConnectionContext(QTcpSocket* connection);
0061
0062 private:
0063 Q_DISABLE_COPY(TQTcpServer)
0064
0065 struct ConnectionContext;
0066
0067 void scheduleDeleteConnectionContext(QTcpSocket* connection);
0068 void finish(std::shared_ptr<ConnectionContext> ctx, bool healthy);
0069
0070 std::shared_ptr<QTcpServer> server_;
0071 std::shared_ptr<TAsyncProcessor> processor_;
0072 std::shared_ptr<apache::thrift::protocol::TProtocolFactory> pfact_;
0073
0074 typedef std::map<QTcpSocket*, std::shared_ptr<ConnectionContext> > ConnectionContextMap;
0075 ConnectionContextMap ctxMap_;
0076 };
0077 }
0078 }
0079 }
0080
0081 #endif