Switch stream readers to use asio event loop

This commit is contained in:
badaix 2020-01-03 22:40:34 +01:00
parent 3eab397543
commit 6d7e25e9af
30 changed files with 630 additions and 583 deletions

View file

@ -1,6 +1,6 @@
/***
This file is part of snapcast
Copyright (C) 2014-2019 Johannes Pohl
Copyright (C) 2014-2020 Johannes Pohl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -32,7 +32,8 @@
using namespace std;
namespace streamreader
{
TcpStream::TcpStream(PcmListener* pcmListener, boost::asio::io_context& ioc, const StreamUri& uri)
: AsioStream<tcp::socket>(pcmListener, ioc, uri), reconnect_timer_(ioc)
@ -62,7 +63,7 @@ TcpStream::TcpStream(PcmListener* pcmListener, boost::asio::io_context& ioc, con
}
void TcpStream::connect()
void TcpStream::do_connect()
{
if (!active_)
return;
@ -108,7 +109,7 @@ void TcpStream::connect()
}
void TcpStream::disconnect()
void TcpStream::do_disconnect()
{
if (stream_)
stream_->close();
@ -116,3 +117,4 @@ void TcpStream::disconnect()
acceptor_->cancel();
reconnect_timer_.cancel();
}
}