Skip to content

Commit

Permalink
Merge pull request #6 from 0x0c/main
Browse files Browse the repository at this point in the history
Main
  • Loading branch information
KikoIshimoto authored Feb 5, 2024
2 parents 141484c + 67c5e90 commit 35f69db
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.15.0)
add_definitions("-Wall")
set(CMAKE_CXX_STANDARD 11)

project(savanna VERSION 0.0.13 DESCRIPTION "boost-beast wrapper")
project(savanna VERSION 0.0.14 DESCRIPTION "boost-beast wrapper")

find_package(Boost 1.70.0 REQUIRED COMPONENTS system)
find_package(OpenSSL REQUIRED)
Expand Down
23 changes: 13 additions & 10 deletions include/savanna/async_websocket.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ namespace savanna
void on_close_l(beast::error_code ec) override { }

public:
~raw_stream_logic() override
virtual ~raw_stream_logic() override
{
raw_stream_ = nullptr;
resolver_ = nullptr;
Expand All @@ -211,6 +211,7 @@ namespace savanna
}
void read() override
{
if(!raw_stream_->is_open()) return;
buffer_.consume(buffer_.size());
raw_stream_->async_read(
buffer_,
Expand All @@ -220,6 +221,7 @@ namespace savanna
}
void write(std::string data) override
{
if(!raw_stream_->is_open()) return;
raw_stream_->async_write(
net::buffer(data),
beast::bind_front_handler(
Expand All @@ -228,6 +230,7 @@ namespace savanna
}
void close() override
{
if(!raw_stream_->is_open()) return;
raw_stream_->async_close(
beast::websocket::close_code::normal,
beast::bind_front_handler(
Expand Down Expand Up @@ -325,7 +328,7 @@ namespace savanna
void on_close_l(beast::error_code ec) override { }

public:
~ssl_stream_logic() override
virtual ~ssl_stream_logic() override
{
ssl_stream_ = nullptr;
resolver_ = nullptr;
Expand All @@ -346,6 +349,7 @@ namespace savanna
}
void read() override
{
if(!ssl_stream_->is_open()) return;
buffer_.consume(buffer_.size());
ssl_stream_->async_read(
buffer_,
Expand All @@ -355,6 +359,7 @@ namespace savanna
}
void write(std::string data) override
{
if(!ssl_stream_->is_open()) return;
ssl_stream_->async_write(
net::buffer(data),
beast::bind_front_handler(
Expand All @@ -363,11 +368,12 @@ namespace savanna
}
void close() override
{
if(!ssl_stream_->is_open()) return
ssl_stream_->async_close(
beast::websocket::close_code::normal,
beast::bind_front_handler(
&interface::on_close,
shared_from_this()));
beast::websocket::close_code::normal,
beast::bind_front_handler(
&interface::on_close,
shared_from_this()));
}
};

Expand Down Expand Up @@ -460,10 +466,7 @@ namespace savanna
ssl_cache_ = ssl_cache;
}

~reuse_websocket_executor()
{
close();
}
virtual ~reuse_websocket_executor(){ }

state current_state()
{
Expand Down
5 changes: 2 additions & 3 deletions include/savanna/reuse_async_url_session.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ namespace ssl_reuse

void on_shutdown_l(beast::error_code ec) override {}
public:
~http_logic() override{
virtual ~http_logic() override{
tcp_stream_ = nullptr;
resolver_ = nullptr;
}
Expand Down Expand Up @@ -378,8 +378,7 @@ namespace ssl_reuse
{
ssl_cache_ = {};
}
~reuse_async_url_session(){
}
virtual ~reuse_async_url_session(){ }

template <class Body>
std::shared_ptr<reuse_async_request_executor<Body>> prepare(ssl::context ssl_ctx){
Expand Down
2 changes: 1 addition & 1 deletion include/savanna/websocket.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ namespace savanna
{
}

~session()
virtual ~session()
{
close();
}
Expand Down

0 comments on commit 35f69db

Please sign in to comment.