| 22 | { |
| 23 | public: |
| 24 | QueryClient(EventLoop* loop, |
| 25 | const InetAddress& serverAddr) |
| 26 | : loop_(loop), |
| 27 | client_(loop, serverAddr, "QueryClient"), |
| 28 | dispatcher_(std::bind(&QueryClient::onUnknownMessage, this, _1, _2, _3)), |
| 29 | codec_(std::bind(&ProtobufDispatcher::onProtobufMessage, &dispatcher_, _1, _2, _3)) |
| 30 | { |
| 31 | dispatcher_.registerMessageCallback<muduo::Answer>( |
| 32 | std::bind(&QueryClient::onAnswer, this, _1, _2, _3)); |
| 33 | dispatcher_.registerMessageCallback<muduo::Empty>( |
| 34 | std::bind(&QueryClient::onEmpty, this, _1, _2, _3)); |
| 35 | client_.setConnectionCallback( |
| 36 | std::bind(&QueryClient::onConnection, this, _1)); |
| 37 | client_.setMessageCallback( |
| 38 | std::bind(&ProtobufCodec::onMessage, &codec_, _1, _2, _3)); |
| 39 | } |
| 40 | |
| 41 | void connect() |
| 42 | { |
nothing calls this directly
no test coverage detected