| 20 | { |
| 21 | public: |
| 22 | QueryServer(EventLoop* loop, |
| 23 | const InetAddress& listenAddr) |
| 24 | : server_(loop, listenAddr, "QueryServer"), |
| 25 | dispatcher_(std::bind(&QueryServer::onUnknownMessage, this, _1, _2, _3)), |
| 26 | codec_(std::bind(&ProtobufDispatcher::onProtobufMessage, &dispatcher_, _1, _2, _3)) |
| 27 | { |
| 28 | dispatcher_.registerMessageCallback<muduo::Query>( |
| 29 | std::bind(&QueryServer::onQuery, this, _1, _2, _3)); |
| 30 | dispatcher_.registerMessageCallback<muduo::Answer>( |
| 31 | std::bind(&QueryServer::onAnswer, this, _1, _2, _3)); |
| 32 | server_.setConnectionCallback( |
| 33 | std::bind(&QueryServer::onConnection, this, _1)); |
| 34 | server_.setMessageCallback( |
| 35 | std::bind(&ProtobufCodec::onMessage, &codec_, _1, _2, _3)); |
| 36 | } |
| 37 | |
| 38 | void start() |
| 39 | { |
nothing calls this directly
no test coverage detected