#include "client_tcp_connect.hpp" #include "abstract_tcp_connect.hpp" #include "logger.hpp" #include "tcp_client.hpp" #include "tinypb_data.hpp" #include namespace tinyrpc { ClientTcpConnection::ClientTcpConnection(int fd, Reactor& reactor, TcpClient& cli) : AbstractTcpConnection(fd, reactor), m_client(cli) { } ClientTcpConnection::~ClientTcpConnection() { } void ClientTcpConnection::process() { while(m_readBuffer.getReadable() > 0) { std::shared_ptr data(new TinypbData); bool ret = m_client.getCoder().decoder(m_readBuffer, *data); if(ret == false) { logger() << "decode error"; break; } std::shared_ptr tmp = std::dynamic_pointer_cast(data); m_respond_datas[tmp->msg_req] = data; } } }