| 57 | } |
| 58 | |
| 59 | void onQuery(const muduo::net::TcpConnectionPtr& conn, |
| 60 | const QueryPtr& message, |
| 61 | muduo::Timestamp) |
| 62 | { |
| 63 | LOG_INFO << "onQuery:\n" << message->GetTypeName() << message->DebugString(); |
| 64 | Answer answer; |
| 65 | answer.set_id(1); |
| 66 | answer.set_questioner("Chen Shuo"); |
| 67 | answer.set_answerer("blog.csdn.net/Solstice"); |
| 68 | answer.add_solution("Jump!"); |
| 69 | answer.add_solution("Win!"); |
| 70 | codec_.send(conn, answer); |
| 71 | |
| 72 | conn->shutdown(); |
| 73 | } |
| 74 | |
| 75 | void onAnswer(const muduo::net::TcpConnectionPtr& conn, |
| 76 | const AnswerPtr& message, |