Skip to content

Commit 4dff91a

Browse files
committed
Update copyright headers; disable precompile header; Fix shutdown exception
1 parent 11476a9 commit 4dff91a

File tree

13 files changed

+118
-22
lines changed

13 files changed

+118
-22
lines changed

CHANGELOG

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
1.0.0.2
2+
- Fix shutdown exception
3+
- Disable precompile header
4+
15
1.0.0.1
26
- Fix shutdown deadlock
37
- Add example

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ set(RELEASE_DIR "${CMAKE_CURRENT_BINARY_DIR}/dist")
4242
configure_file(src/version.h.in dist/include/websocket_proxy/version.h)
4343

4444
set(SOURCES
45+
# src/pch.cpp
4546
src/main.cpp
4647
src/websocket_proxy.cpp
4748
)
@@ -50,6 +51,7 @@ add_executable(websocket_proxy ${SOURCES})
5051
target_include_directories(websocket_proxy PUBLIC include ${slick_queue_SOURCE_DIR}/include ${RELEASE_DIR}/include)
5152
target_link_libraries(websocket_proxy PRIVATE spdlog::spdlog_header_only Boost::asio Boost::beast Boost::context OpenSSL::SSL OpenSSL::Crypto)
5253
target_link_libraries(websocket_proxy PRIVATE ${VCPKG_ROOT})
54+
# target_precompile_headers(websocket_proxy PRIVATE "src/pch.hpp")
5355

5456
if (MSVC)
5557
set(CMAKE_CXX_FLAGS_RELEASE "-O2")

include/websocket_proxy/types.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// MIT License
2-
//
1+
// The MIT License (MIT)
32
// Copyright (c) 2024-2025 Kun Zhao
43
//
54
// Permission is hereby granted, free of charge, to any person obtaining a copy

include/websocket_proxy/websocket_proxy_client.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// MIT License
2-
//
1+
// The MIT License (MIT)
32
// Copyright (c) 2024-2025 Kun Zhao
43
//
54
// Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -164,12 +163,18 @@ inline WebsocketProxyClient::WebsocketProxyClient(WebsocketProxyCallback* callba
164163
}
165164
}
166165

167-
inline WebsocketProxyClient::~WebsocketProxyClient() {
168-
if (server_pid_.load(std::memory_order_relaxed)) {
166+
inline WebsocketProxyClient::~WebsocketProxyClient()
167+
{
168+
if (server_pid_.load(std::memory_order_relaxed))
169+
{
169170
unregister();
170171
}
171-
run_->store(false, std::memory_order_release);
172-
if (worker_thread_ && worker_thread_->joinable()) {
172+
if (run_)
173+
{
174+
run_->store(false, std::memory_order_release);
175+
}
176+
if (worker_thread_ && worker_thread_->joinable())
177+
{
173178
// #ifdef _WIN32
174179
// worker_thread_->detach();
175180
// #endif // _WIN32

src/main.cpp

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
1-
// websockets_proxy.cpp : This file contains the 'main' function. Program execution begins and ends there.
2-
//
3-
// #include "pch.hpp"
1+
// The MIT License (MIT)
2+
// Copyright (c) 2024-2025 Kun Zhao
3+
//
4+
// Permission is hereby granted, free of charge, to any person obtaining a copy
5+
// of this software and associated documentation files (the "Software"), to deal
6+
// in the Software without restriction, including without limitation the rights
7+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
// copies of the Software, and to permit persons to whom the Software is
9+
// furnished to do so, subject to the following conditions:
10+
//
11+
// The above copyright notice and this permission notice shall be included in all
12+
// copies or substantial portions of the Software.
13+
//
14+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
// SOFTWARE.
21+
22+
#include "pch.hpp"
423

524
#include "spdlog_include.h"
625
#include <spdlog/async.h>

src/pch.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// The MIT License (MIT)
2+
// Copyright (c) 2024-2025 Kun Zhao
3+
//
4+
// Permission is hereby granted, free of charge, to any person obtaining a copy
5+
// of this software and associated documentation files (the "Software"), to deal
6+
// in the Software without restriction, including without limitation the rights
7+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
// copies of the Software, and to permit persons to whom the Software is
9+
// furnished to do so, subject to the following conditions:
10+
//
11+
// The above copyright notice and this permission notice shall be included in all
12+
// copies or substantial portions of the Software.
13+
//
14+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
// SOFTWARE.
21+
22+
#include "pch.hpp"

src/pch.hpp

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// The MIT License (MIT)
2+
// Copyright (c) 2024-2025 Kun Zhao
3+
//
4+
// Permission is hereby granted, free of charge, to any person obtaining a copy
5+
// of this software and associated documentation files (the "Software"), to deal
6+
// in the Software without restriction, including without limitation the rights
7+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
// copies of the Software, and to permit persons to whom the Software is
9+
// furnished to do so, subject to the following conditions:
10+
//
11+
// The above copyright notice and this permission notice shall be included in all
12+
// copies or substantial portions of the Software.
13+
//
14+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
// SOFTWARE.
21+
22+
#pragma once
23+
24+
#include <boost/asio.hpp>
25+
#include <boost/asio/signal_set.hpp>
26+
#include <boost/asio/spawn.hpp>
27+
#include <boost/asio/ssl.hpp>
28+
#include <boost/asio/strand.hpp>
29+
#include <boost/beast/core.hpp>
30+
#include <boost/beast/websocket.hpp>
31+
#include <boost/beast/websocket/ssl.hpp>
32+
#include "spdlog_include.h"
33+
#include "slick_queue.h"
34+
35+
#if defined(_MSC_VER)
36+
#include <windows.h>
37+
#include <tchar.h>
38+
#endif
39+
40+
#include <atomic>
41+
#include <thread>
42+
#include <string>
43+
#include <format>
44+
#include <atomic>
45+
#include <unordered_map>
46+
#include <unordered_set>
47+
#include <cstdlib>
48+
#include <cstdint>
49+
#include <stdexcept>
50+
#include <cassert>

src/spdlog_include.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// MIT License
2-
//
1+
// The MIT License (MIT)
32
// Copyright (c) 2024-2025 Kun Zhao
43
//
54
// Permission is hereby granted, free of charge, to any person obtaining a copy

src/version.h.in

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// MIT License
2-
//
1+
// The MIT License (MIT)
32
// Copyright (c) 2024-2025 Kun Zhao
43
//
54
// Permission is hereby granted, free of charge, to any person obtaining a copy

src/websocket.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// MIT License
2-
//
1+
// The MIT License (MIT)
32
// Copyright (c) 2024-2025 Kun Zhao
43
//
54
// Permission is hereby granted, free of charge, to any person obtaining a copy

0 commit comments

Comments
 (0)