Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Src && Example && CI/CD] Make it adapt to UNIX, fix some bugs and implement RPC module #14

Merged
merged 78 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
e22b5f0
[src] Fix logtime string race contidion
Sigma711 Jul 9, 2023
04c82ad
[src] Fix race condition bug for UNIX Poller
Sigma711 Jul 9, 2023
9249914
[src] Adjust format
Sigma711 Jul 9, 2023
6bb7063
[src] Modify argv passing method for UNIX Poller
Sigma711 Jul 9, 2023
bae8c24
[src] Modify all wrong spells
Sigma711 Jul 11, 2023
a76e7ad
[src] Modify all wrong spells and solve one FIXME
Sigma711 Jul 14, 2023
e606cef
[src] Solve one FIXME
Sigma711 Jul 14, 2023
4157f4c
[src] Fix one warning about type conversion
Sigma711 Jul 14, 2023
6c30a67
[src] Modify wrong spells
Sigma711 Jul 14, 2023
5e1f3e2
[config] Modify gitignore file
Sigma711 Jul 15, 2023
f324026
[src] Develop byte array retrieving method for IoBuffer
Sigma711 Jul 25, 2023
d6638f2
[src] Develop called once guarantee for staring of EventManager
Sigma711 Jul 29, 2023
7148853
[src && example] Refactor the use of EventManager (Make users manage …
Sigma711 Aug 10, 2023
4fc9587
[src] Improve EventManager and ReactorManager
Sigma711 Aug 11, 2023
6f83460
[src] Add destructor for ReactorManager
Sigma711 Aug 11, 2023
2e064fe
[example] Improve the code of HttpServer
Sigma711 Aug 11, 2023
1f8e15d
[src] Modify EventManager callback register
Sigma711 Aug 11, 2023
4c2f854
[src && example] Refactor I/O threads number setting method
Sigma711 Aug 13, 2023
a14f6c2
[src] Develop RPC module
Sigma711 Aug 16, 2023
68167c0
[CI/CD] Add dependencies for installing
Sigma711 Aug 16, 2023
862a65f
[CI/CD] Add dependencies for installing
Sigma711 Aug 16, 2023
f358210
[CI/CD] Add dependencies for installing
Sigma711 Aug 16, 2023
ad4d3d0
[CI/CD] Add dependencies for installing
Sigma711 Aug 16, 2023
31b1701
[CI/CD] Add dependencies for installing
Sigma711 Aug 16, 2023
868dd4e
[CI/CD] Add dependencies for installing
Sigma711 Aug 16, 2023
d255b1f
[src] Delete generated pb code files
Sigma711 Aug 17, 2023
088dfe1
[config] Add files to ignore
Sigma711 Aug 17, 2023
269d9db
[src] Develop RPC module
Sigma711 Aug 17, 2023
e625424
[CI/CD] Add dependencies for installing
Sigma711 Aug 17, 2023
65ee5e5
[src] Modify CMakeLists.txt
Sigma711 Aug 17, 2023
f28cb83
[src] Modify CMakeLists.txt
Sigma711 Aug 17, 2023
5f9f4a1
[src] Modify enum using
Sigma711 Aug 19, 2023
06e1561
[src] Add comments
Sigma711 Aug 19, 2023
c71fa0d
[src] Make the connection pointer initialized when construct RpcChann…
Sigma711 Aug 19, 2023
65420b3
[src] Complete Sync RPC channel for RPC client
Sigma711 Aug 22, 2023
d52b302
[CI/CD] Add dependencies for installing
Sigma711 Aug 22, 2023
561e213
[CI/CD] Modify dependencies for installing
Sigma711 Aug 22, 2023
9677a34
[CI/CD] Modify dependencies for installing
Sigma711 Aug 22, 2023
d38a8f1
[CI/CD] Modify dependencies for installing
Sigma711 Aug 22, 2023
d966a11
[CI/CD] Modify dependencies for installing
Sigma711 Aug 22, 2023
c79dcad
[CI/CD] Modify dependencies for installing protobuf
Sigma711 Aug 22, 2023
31f2dff
[CI/CD] Modify dependencies for installing protobuf
Sigma711 Aug 22, 2023
cb6d378
[CI/CD] Modify dependencies for installing protobuf
Sigma711 Aug 22, 2023
04980ac
[CI/CD] Modify dependencies for installing protobuf
Sigma711 Aug 22, 2023
5cd8330
[CI/CD] Modify dependencies for installing protobuf
Sigma711 Aug 22, 2023
24f0dcc
[src && example] Unroot ThreadPool from Server
Sigma711 Aug 25, 2023
811ff27
[src && example] Develop TimeService example
Sigma711 Aug 25, 2023
1e26ce8
[src] Fix the bug of starting once of each EventManager
Sigma711 Aug 25, 2023
e4da8e9
[src] Fix the bug of UNIX adaption in RpcChannel
Sigma711 Aug 25, 2023
0c8a5c0
[src] Fix the bug of logger print format in RpcCodec
Sigma711 Aug 25, 2023
222d018
[src] Fix the bug of logger print format in RpcCodec
Sigma711 Aug 25, 2023
1b996a8
[src] Adjust EventManager
Sigma711 Aug 25, 2023
7e69506
[src] Fix the bug of starting once of each EventManager
Sigma711 Aug 25, 2023
94e8136
[src] Fix the bug of starting once of each EventManager
Sigma711 Aug 25, 2023
572a0fa
[example] Fix the bug of the creating of EventManager in TimeService …
Sigma711 Aug 25, 2023
4d397bf
[src] Add specified buffer size reading API for IoBuffer
Sigma711 Aug 25, 2023
51b5c01
[example] Call done closure after processing one RPC service
Sigma711 Aug 25, 2023
308fdac
[src] Fix the bug of blocking reading of RpcCodec for single socket fd
Sigma711 Aug 25, 2023
389b14c
[CI/CD] Modify dependencies for installing protobuf
Sigma711 Aug 26, 2023
7d2d866
[src] Modify CMakeLists.txt for deleting shared library generating
Sigma711 Aug 26, 2023
1beba85
[CI/CD] Modify dependencies for installing protobuf
Sigma711 Aug 26, 2023
0ebfffa
[src] Extend the ability of RpcSyncChannel (let users set socket opti…
Sigma711 Aug 26, 2023
10f206b
[src] Fix the bug of check the thead pointer (nullpter) when destroyi…
Sigma711 Aug 28, 2023
aa99824
[src] Improve Reading Func of IoBuffer for ignoring signals by using …
Sigma711 Aug 28, 2023
f2141e9
[src] Print connection error info by the user buffer instead of the r…
Sigma711 Aug 28, 2023
7ba7ed1
[src] Improve calling strerror_r() (discard its return value)
Sigma711 Aug 28, 2023
5653a96
[src] Make Connecting::DoWithError() adapting to UNIX
Sigma711 Aug 28, 2023
cba3db6
[src] Fix the bug of pass a shared_ptr by value to a lambda in RpcSer…
Sigma711 Aug 29, 2023
451995e
[src] Improve EventManager::Quit() (Call WakeUp())
Sigma711 Aug 29, 2023
fa38d8a
[src] Fix data type in comparision expressions in RpcCodec
Sigma711 Aug 30, 2023
4716923
[build] Add LSan as a debug build option
Sigma711 Aug 30, 2023
62b961a
[build] Make CMakeLists.txt adapted to UNIX
Sigma711 Aug 30, 2023
faa14ec
[src] Discard the return value of ::strerror_r()
Sigma711 Aug 30, 2023
9a957fb
[src] Do some trivial improvements about unused things
Sigma711 Aug 30, 2023
0394f6a
[CI/CD] Use Ninja instead of Make
Sigma711 Aug 31, 2023
baa5d62
[CI/CD] Use Ninja instead of Make
Sigma711 Aug 31, 2023
d8467d1
[CI/CD] Adjust the format of GitHub Actions Workflow config files
Sigma711 Aug 31, 2023
fcc70a4
[CI/CD] Modify build the toolchain
Sigma711 Aug 31, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
<!-- taotu PR Template -->

### Purpose
<!-- Links to Design Docs, Github Issues or a few words about the purpose of this PR -->
#

## Purpose
<!-- Links to Design Docs, GitHub Issues or a few words about the purpose of this PR -->

- Purpose.

### Changes
## Changes
<!-- Major changes in this PR: -->

- No changes.

### Review Instructions
## Review Instructions
<!-- Please provide instructions about how should a reviewer test/verify the changes in this PR: -->

- No instructions.
35 changes: 30 additions & 5 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,42 @@ jobs:
- uses: actions/checkout@v2
- name: init
run: mkdir build
- name: Install protobuf manually
run: |
sudo apt-get install libtool pkg-config wget git ninja-build
git clone --recursive https://github.com/protocolbuffers/protobuf.git
cd protobuf
git checkout tags/v24.2
mkdir build
cd build
cmake -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release -G Ninja ..
ninja
sudo ninja install
sudo ldconfig
- name: Install gtest manually
run: sudo apt-get install libgtest-dev && cd /usr/src/gtest && sudo cmake CMakeLists.txt && sudo make && sudo cp lib/*.a /usr/lib && sudo ln -s /usr/lib/libgtest.a /usr/local/lib/libgtest.a && sudo ln -s /usr/lib/libgtest_main.a /usr/local/lib/libgtest_main.a
run: |
sudo apt-get install libgtest-dev
cd /usr/src/gtest
sudo cmake -DCMAKE_BUILD_TYPE=Release -G Ninja CMakeLists.txt
sudo ninja
sudo cp lib/*.a /usr/lib
sudo ln -s /usr/lib/libgtest.a /usr/local/lib/libgtest.a
sudo ln -s /usr/lib/libgtest_main.a /usr/local/lib/libgtest_main.a
- name: Install llhttp manually
working-directory: ${{github.workspace}}/..
run: git clone https://github.com/nodejs/llhttp.git && cd llhttp && sudo apt-get install npm && npm install && make && sudo make install
run: |
git clone https://github.com/nodejs/llhttp.git
cd llhttp
sudo apt-get install npm
npm install
make
sudo make install
- name: cmake
working-directory: build
run: cmake ..
- name: make
run: cmake -DProtobuf_DIR=`pkg-config --variable=prefix protobuf` -DCMAKE_BUILD_TYPE=Release -G Ninja ..
- name: ninja
working-directory: build
run: make
run: ninja
- name: gtest
working-directory: ${{github.workspace}}/build/output/bin
# Execute tests defined by the CMake configuration.
Expand Down
34 changes: 30 additions & 4 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,51 @@ env:

jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# The CMake configure and build commands are platform-agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Install protobuf manually
run: |
sudo apt-get install libtool pkg-config wget git ninja-build
git clone --recursive https://github.com/protocolbuffers/protobuf.git
cd protobuf
git checkout tags/v24.2
mkdir build
cd build
cmake -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release -G Ninja ..
ninja
sudo ninja install
sudo ldconfig

- name: Install gtest manually
run: sudo apt-get install libgtest-dev && cd /usr/src/gtest && sudo cmake CMakeLists.txt && sudo make && sudo cp lib/*.a /usr/lib && sudo ln -s /usr/lib/libgtest.a /usr/local/lib/libgtest.a && sudo ln -s /usr/lib/libgtest_main.a /usr/local/lib/libgtest_main.a
run: |
sudo apt-get install libgtest-dev
cd /usr/src/gtest
sudo cmake -DCMAKE_BUILD_TYPE=Release -G Ninja CMakeLists.txt
sudo ninja
sudo cp lib/*.a /usr/lib
sudo ln -s /usr/lib/libgtest.a /usr/local/lib/libgtest.a
sudo ln -s /usr/lib/libgtest_main.a /usr/local/lib/libgtest_main.a

- name: Install llhttp manually
working-directory: ${{github.workspace}}/..
run: git clone https://github.com/nodejs/llhttp.git && cd llhttp && sudo apt-get install npm && npm install && make && sudo make install
run: |
git clone https://github.com/nodejs/llhttp.git
cd llhttp
sudo apt-get install npm
npm install
make
sudo make install

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -G Ninja

- name: Build
# Build your program with the given configuration
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
.cache/*
.vscode/*
build/*
build*/*
.idea/*
src/rpc.pb*
example/rpc_demo/time_service/time_service.pb*
cmake-build-debug/*
cmake-build-release/*
CMakeLists.txt.user
Expand Down
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++17")

SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++17 -fsanitize=address -Wall -O0 -DTAOTU_DEBUG")

ADD_DEFINITIONS(-Wno-format-security)
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
message(STATUS "Darwin detected, not using -fsanitize=leak")
else()
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=leak")
endif()

STRING(REPLACE ";" " " CMAKE_CXX_FLAGS "${CXX_FLAGS}")
ADD_DEFINITIONS(-Wno-format-security)

IF(CMAKE_BUILD_TYPE AND (CMAKE_BUILD_TYPE STREQUAL "Debug"))
MESSAGE(STATUS "CMAKE_CXX_FLAGS_DEBUG = " ${CMAKE_CXX_FLAGS_DEBUG})
Expand Down
1 change: 1 addition & 0 deletions example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ ADD_SUBDIRECTORY(simple_time)
ADD_SUBDIRECTORY(chat_room)
ADD_SUBDIRECTORY(pingpong)
ADD_SUBDIRECTORY(http_server)
ADD_SUBDIRECTORY(rpc_demo)
20 changes: 9 additions & 11 deletions example/chat_room/chat_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@
#include <stdio.h>

ChatServer::ChatServer(const taotu::NetAddress& listen_address,
bool should_reuse_port, size_t io_thread_amount,
size_t calculation_thread_amount)
: event_manager_(new taotu::EventManager),
server_(std::make_unique<taotu::Server>(
event_manager_, listen_address, should_reuse_port, io_thread_amount,
calculation_thread_amount)),
bool should_reuse_port, size_t io_thread_amount)
: event_managers_(io_thread_amount, new taotu::EventManager),
server_(std::make_unique<taotu::Server>(&event_managers_, listen_address,
should_reuse_port)),
codec_([this](taotu::Connecting& connection, const std::string& message,
taotu::TimePoint time_point) {
this->OnCodecMessage(connection, message, time_point);
Expand All @@ -33,14 +31,14 @@ ChatServer::ChatServer(const taotu::NetAddress& listen_address,
});
}
ChatServer::~ChatServer() {
delete event_manager_;
size_t event_managers_size = event_managers_.size();
for (size_t i = 0; i < event_managers_size; ++i) {
delete event_managers_[i];
}
taotu::END_LOG();
}

void ChatServer::Start() {
server_->Start();
event_manager_->Work();
}
void ChatServer::Start() { server_->Start(); }

void ChatServer::OnConnectionCallback(taotu::Connecting& connection) {
taotu::LOG_DEBUG(
Expand Down
6 changes: 4 additions & 2 deletions example/chat_room/chat_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@

class ChatServer : taotu::NonCopyableMovable {
public:
typedef std::vector<taotu::EventManager*> EventManagers;

ChatServer(const taotu::NetAddress& listen_address, bool should_reuse_port,
size_t io_thread_amount = 3, size_t calculation_thread_amount = 0);
size_t io_thread_amount = 3);
~ChatServer();

// Start the server
Expand All @@ -37,7 +39,7 @@ class ChatServer : taotu::NonCopyableMovable {
void OnCodecMessage(taotu::Connecting& connection, const std::string& message,
taotu::TimePoint);

taotu::EventManager* event_manager_;
EventManagers event_managers_;
std::unique_ptr<taotu::Server> server_;
Codec codec_;
ConnectionSet connections_;
Expand Down
12 changes: 2 additions & 10 deletions example/chat_room/server_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
#include "chat_server.h"

// Call it by:
// './chat_server [port [amount-of-I/O-threads
// [amount-of-calculation-threads]]]'
// './chat_server [port [amount-of-I/O-threads]]'
int main(int argc, char* argv[]) {
taotu::START_LOG("server_main_log.txt");
if (1 == argc) {
Expand All @@ -25,18 +24,11 @@ int main(int argc, char* argv[]) {
std::stoi(std::string{argv[1]}))},
false};
chat_server.Start();
} else if (3 == argc) {
ChatServer chat_server{
taotu::NetAddress{
static_cast<uint16_t>(std::stoi(std::string{argv[1]}))},
false, static_cast<size_t>(std::stoi(std::string{argv[2]}))};
chat_server.Start();
} else {
ChatServer chat_server{
taotu::NetAddress{
static_cast<uint16_t>(std::stoi(std::string{argv[1]}))},
false, static_cast<size_t>(std::stoi(std::string{argv[2]})),
static_cast<size_t>(std::stoi(std::string{argv[3]}))};
false, static_cast<size_t>(std::stoi(std::string{argv[2]}))};
chat_server.Start();
}
return 0;
Expand Down
22 changes: 11 additions & 11 deletions example/http_server/http_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@

#include "http_server.h"

#include <stddef.h>

#include "http_parser.h"
#include "http_response.h"

HttpServer::HttpServer(const taotu::NetAddress& listen_address,
bool should_reuse_port, size_t io_thread_amount,
size_t calculation_thread_amount)
: event_manager_(new taotu::EventManager),
server_(std::make_unique<taotu::Server>(
event_manager_, listen_address, should_reuse_port, io_thread_amount,
calculation_thread_amount)) {
bool should_reuse_port, size_t io_thread_amount)
: event_managers_(io_thread_amount, new taotu::EventManager),
server_(std::make_unique<taotu::Server>(&event_managers_, listen_address,
should_reuse_port)) {
server_->SetConnectionCallback([this](taotu::Connecting& connection) {
this->OnConnectionCallback(connection);
});
Expand All @@ -31,14 +31,14 @@ HttpServer::HttpServer(const taotu::NetAddress& listen_address,
}

HttpServer::~HttpServer() {
delete event_manager_;
size_t event_managers_size = event_managers_.size();
for (size_t i = 0; i < event_managers_size; ++i) {
delete event_managers_[i];
}
taotu::END_LOG();
}

void HttpServer::Start() {
server_->Start();
event_manager_->Work();
}
void HttpServer::Start() { server_->Start(); }

void HttpServer::OnConnectionCallback(taotu::Connecting& connection) {
if (connection.IsConnected()) {
Expand Down
6 changes: 4 additions & 2 deletions example/http_server/http_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@

class HttpServer : taotu::NonCopyableMovable {
public:
typedef std::vector<taotu::EventManager*> EventManagers;

HttpServer(const taotu::NetAddress& listen_address, bool should_reuse_port,
size_t io_thread_amount = 4, size_t calculation_thread_amount = 0);
size_t io_thread_amount = 4);
~HttpServer();

// Start the server
Expand All @@ -44,7 +46,7 @@ class HttpServer : taotu::NonCopyableMovable {
// Called when a request arriving
void OnRequest(taotu::Connecting& connection, const HttpParser& http_parser);

taotu::EventManager* event_manager_;
EventManagers event_managers_;
std::unique_ptr<taotu::Server> server_;

std::function<void(const HttpParser&, HttpResponse*)> HttpCallback_;
Expand Down
16 changes: 2 additions & 14 deletions example/http_server/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ void OnRequest(const HttpParser& http_parser, HttpResponse* http_response) {
}

// Call it by:
// './http_server [port [amount-of-I/O-threads
// [amount-of-calculation-threads]]]'
// './http_server [port [amount-of-I/O-threads]]'
int main(int argc, char* argv[]) {
taotu::START_LOG("http_server_log.txt");
if (1 == argc) {
Expand All @@ -59,22 +58,11 @@ int main(int argc, char* argv[]) {
OnRequest(http_parser, http_response);
});
http_server.Start();
} else if (3 == argc) {
HttpServer http_server{
taotu::NetAddress{
static_cast<uint16_t>(std::stoi(std::string{argv[1]}))},
false, static_cast<size_t>(std::stoi(std::string{argv[2]}))};
http_server.SetHttpCallback(
[](const HttpParser& http_parser, HttpResponse* http_response) {
OnRequest(http_parser, http_response);
});
http_server.Start();
} else {
HttpServer http_server{
taotu::NetAddress{
static_cast<uint16_t>(std::stoi(std::string{argv[1]}))},
false, static_cast<size_t>(std::stoi(std::string{argv[2]})),
static_cast<size_t>(std::stoi(std::string{argv[3]}))};
false, static_cast<size_t>(std::stoi(std::string{argv[2]}))};
http_server.SetHttpCallback(
[](const HttpParser& http_parser, HttpResponse* http_response) {
OnRequest(http_parser, http_response);
Expand Down
20 changes: 9 additions & 11 deletions example/pingpong/pingpong_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@
#include "pingpong_server.h"

PingpongServer::PingpongServer(const taotu::NetAddress& listen_address,
bool should_reuse_port, size_t io_thread_amount,
size_t calculation_thread_amount)
: event_manager_(new taotu::EventManager),
server_(std::make_unique<taotu::Server>(
event_manager_, listen_address, should_reuse_port, io_thread_amount,
calculation_thread_amount)) {
bool should_reuse_port, size_t io_thread_amount)
: event_managers_(io_thread_amount, new taotu::EventManager),
server_(std::make_unique<taotu::Server>(&event_managers_, listen_address,
should_reuse_port)) {
server_->SetConnectionCallback([this](taotu::Connecting& connection) {
this->OnConnectionCallback(connection);
});
Expand All @@ -27,14 +25,14 @@ PingpongServer::PingpongServer(const taotu::NetAddress& listen_address,
});
}
PingpongServer::~PingpongServer() {
delete event_manager_;
size_t event_managers_size = event_managers_.size();
for (size_t i = 0; i < event_managers_size; ++i) {
delete event_managers_[i];
}
taotu::END_LOG();
}

void PingpongServer::Start() {
server_->Start();
event_manager_->Work();
}
void PingpongServer::Start() { server_->Start(); }

void PingpongServer::OnConnectionCallback(taotu::Connecting& connection) {
if (connection.IsConnected()) {
Expand Down
Loading
Loading