MCPcopy Create free account
hub / github.com/caozhiyi/CppNet / ReadFunc

Function ReadFunc

test/simple/CppNetServer.cpp:24–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22}
23
24void ReadFunc(const Handle& handle, base::CBuffer* data, uint32_t len, uint32_t error) {
25 if (error != CEC_CLOSED && error != CEC_CONNECT_BREAK) {
26 std::cout << "[ReadFunc]" << std::endl;
27 std::cout << *(data) << std::endl;
28 data->Clear();
29 std::cout << "Thread ID : " << std::this_thread::get_id() << std::endl;
30 std::cout << "Read size : " << len << std::endl << std::endl;
31 auto msg = GetMsg();
32 handle->Write(msg.c_str(), msg.length());
33 } else {
34 std::cout << "Close" << std::endl;
35 }
36}
37
38void ConnectFunc(const Handle& handle, uint32_t err) {
39 if (err == CEC_SUCCESS) {

Callers

nothing calls this directly

Calls 3

GetMsgFunction · 0.70
ClearMethod · 0.45
WriteMethod · 0.45

Tested by

no test coverage detected