From 27a298b7f02c2510255b76013981d37d10b04382 Mon Sep 17 00:00:00 2001 From: dongl <2725096176@qq.com> Date: Thu, 11 May 2023 18:57:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E6=AC=A1=E6=8F=90=E4=BA=A4=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9=E6=88=90=E5=8A=9F=20=20=20?= =?UTF-8?q?=20=20=20mph->set=5Fmpb=5Fsize(request->ByteSizeLong());?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MC/api/main.cpp | 13 +------------ MP/Request.cpp | 6 +----- MP/Response.cpp | 9 --------- MS/mmm/management.cpp | 5 ----- MS/works/controller/UserProveController.cpp | 3 --- 5 files changed, 2 insertions(+), 34 deletions(-) diff --git a/MC/api/main.cpp b/MC/api/main.cpp index 589af24..ed74bdf 100644 --- a/MC/api/main.cpp +++ b/MC/api/main.cpp @@ -55,6 +55,7 @@ int main(int argc, char **argv) { auto request = new Request(mp::MP_REQUEST_LOGIN, mp::MP_REQUEST_LOGIN_ACCOUNT, "783556037", "Aa316216"); auto packet = request->packet(); + bufferevent_write(bev, packet.c_str(), packet.size()); bufferevent_write(bev, packet.c_str(), packet.size()); delete request; @@ -68,18 +69,6 @@ int main(int argc, char **argv) { char b[257]; strncpy(b, packet.c_str() + strlen(h), packet.size() - strlen(h)); - auto mph = new mp::mph(); - mph->ParseFromString(h); - printf("h size: %hhu\n", l); - printf("b size: %hhu\n", mph->mpb_size()); - printf("total size: %hhu\n", 1 + l + mph->mpb_size()); - printf("str size: %zu\n", packet.size()); - - std::string temp; - temp.assign(packet.c_str(), packet.length()); - printf("temp str: %s\n", packet.c_str()); - - fflush(stdout); event_base_dispatch(base); event_base_free(base); diff --git a/MP/Request.cpp b/MP/Request.cpp index 740d6a9..36aaffe 100644 --- a/MP/Request.cpp +++ b/MP/Request.cpp @@ -24,7 +24,7 @@ void Request::init() { request = new mp::request(); request->set_allocated_body(body); request->set_allocated_cqi(cqi); - mph->set_mpb_size(body->ByteSizeLong() + cqi->ByteSizeLong()); + mph->set_mpb_size(request->ByteSizeLong()); } std::string Request::packet() { @@ -32,12 +32,8 @@ std::string Request::packet() { std::string temp; temp.push_back(mph->ByteSizeLong()); - std::cout << temp << std::endl; mph->AppendToString(&temp); - std::cout << temp << std::endl; request->AppendToString(&temp); - std::cout << temp << std::endl; - return temp; } diff --git a/MP/Response.cpp b/MP/Response.cpp index 9d4d872..134f757 100644 --- a/MP/Response.cpp +++ b/MP/Response.cpp @@ -24,17 +24,8 @@ std::string Response::packet () { std::string temp; temp.push_back(mph->ByteSizeLong()); - std::cout << temp << std::endl; mph->AppendToString(&temp); - std::cout << temp << std::endl; response->AppendToString(&temp); - std::cout << temp << std::endl; - - - printf("h size: %zu\n", mph->ByteSizeLong()); - printf("b size: %hhu\n", mph->mpb_size()); - printf("total size: %zu\n", 1 + mph->ByteSizeLong() + mph->mpb_size()); - printf("str size: %zu\n", temp.size()); return temp; } diff --git a/MS/mmm/management.cpp b/MS/mmm/management.cpp index 076b71c..b410b3e 100644 --- a/MS/mmm/management.cpp +++ b/MS/mmm/management.cpp @@ -63,9 +63,6 @@ void management::read_packet(bufferevent *bev, sockaddr_in *addr) { memset(packet_h, 0, sizeof(packet_h)); memset(packet_b, 0, sizeof(packet_b)); - std::cout << len_index << std::endl; - std::cout << buff << std::endl; - /// read L 读包长度 uint8_t packetLen; // 取包长度 @@ -95,8 +92,6 @@ void management::read_packet(bufferevent *bev, sockaddr_in *addr) { // 更新buffer长度 len_index -= mph->mpb_size(); - std::cout << buff << std::endl; - // 请求 auto request = analysis(mph, packet_b)(bev, addr); // 响应 diff --git a/MS/works/controller/UserProveController.cpp b/MS/works/controller/UserProveController.cpp index 0a865af..4d43962 100644 --- a/MS/works/controller/UserProveController.cpp +++ b/MS/works/controller/UserProveController.cpp @@ -5,9 +5,6 @@ #include "UserProveController.h" void UserProveController::run(std::shared_ptr request, std::shared_ptr response) { - printf("客户端版本:%f", request->m_cqi.cqi_version()); - printf("account:%s", request->m_body.account().c_str()); - // 登陆 if (request->m_mph->mp_type() == mp::MP_REQUEST_LOGIN) { auto sri = service.login(request->m_body.subcommand(),