1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-26 14:37:44 +00:00

api now builds and seems to work

This commit is contained in:
NotAdam 2018-10-26 21:14:30 +11:00
parent 80c49c3537
commit e834726d45
3 changed files with 6 additions and 5 deletions

View file

@ -28,4 +28,5 @@ else()
endif() endif()
endif() endif()
# force standalone asio
add_definitions( -DASIO_STANDALONE )

View file

@ -187,11 +187,11 @@ namespace SimpleWeb {
virtual void connect()=0; virtual void connect()=0;
std::shared_ptr<asio::deadline_timer> get_timeout_timer() { std::shared_ptr< asio::basic_waitable_timer< std::chrono::steady_clock > > get_timeout_timer() {
if(config.timeout==0) if(config.timeout==0)
return nullptr; return nullptr;
auto timer=std::make_shared<asio::deadline_timer>(io_service); auto timer=std::make_shared< asio::basic_waitable_timer< std::chrono::steady_clock > >(io_service);
timer->expires_from_now( std::chrono::seconds( config.timeout ) ); timer->expires_from_now( std::chrono::seconds( config.timeout ) );
timer->async_wait([this](const std::error_code& ec) { timer->async_wait([this](const std::error_code& ec) {
if(!ec) { if(!ec) {

View file

@ -220,11 +220,11 @@ namespace SimpleWeb {
virtual void accept()=0; virtual void accept()=0;
std::shared_ptr<asio::deadline_timer> get_timeout_timer(const std::shared_ptr<socket_type> &socket, long seconds) { std::shared_ptr< asio::basic_waitable_timer< std::chrono::steady_clock > > get_timeout_timer(const std::shared_ptr<socket_type> &socket, long seconds) {
if(seconds==0) if(seconds==0)
return nullptr; return nullptr;
auto timer=std::make_shared<asio::deadline_timer>(*io_service); auto timer = std::make_shared< asio::basic_waitable_timer< std::chrono::steady_clock > >(*io_service);
timer->expires_from_now( std::chrono::seconds( seconds ) ); timer->expires_from_now( std::chrono::seconds( seconds ) );
timer->async_wait([socket](const std::error_code& ec){ timer->async_wait([socket](const std::error_code& ec){
if(!ec) { if(!ec) {