mirror of
https://github.com/badaix/snapcast.git
synced 2025-08-03 08:39:49 +02:00
merge socket and client connection
git-svn-id: svn://elaine/murooma/trunk@275 d8a302eb-03bc-478d-80e4-98257eca68ef
This commit is contained in:
parent
3dbbf8e3e5
commit
d215580afe
10 changed files with 69 additions and 239 deletions
|
@ -1,68 +0,0 @@
|
|||
#ifndef STREAM_SERVER_H
|
||||
#define STREAM_SERVER_H
|
||||
|
||||
#include <boost/asio.hpp>
|
||||
#include <vector>
|
||||
#include <thread>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
|
||||
#include "serverConnection.h"
|
||||
#include "common/timeUtils.h"
|
||||
#include "common/queue.h"
|
||||
#include "common/message.h"
|
||||
#include "common/headerMessage.h"
|
||||
#include "common/sampleFormat.h"
|
||||
|
||||
|
||||
using boost::asio::ip::tcp;
|
||||
typedef std::shared_ptr<tcp::socket> socket_ptr;
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
class StreamServer
|
||||
{
|
||||
public:
|
||||
StreamServer(unsigned short port);
|
||||
void send(shared_ptr<BaseMessage> message);
|
||||
|
||||
void start();
|
||||
void stop();
|
||||
|
||||
private:
|
||||
void acceptor();
|
||||
set<shared_ptr<ServerSession>> sessions;
|
||||
boost::asio::io_service io_service_;
|
||||
unsigned short port_;
|
||||
shared_ptr<HeaderMessage> headerChunk;
|
||||
shared_ptr<SampleFormat> sampleFormat;
|
||||
thread* acceptThread;
|
||||
};
|
||||
|
||||
|
||||
class ServerException : public std::exception
|
||||
{
|
||||
public:
|
||||
ServerException(const std::string& what) : what_(what)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~ServerException() throw()
|
||||
{
|
||||
}
|
||||
|
||||
virtual const char* what() const throw()
|
||||
{
|
||||
return what_.c_str();
|
||||
}
|
||||
|
||||
private:
|
||||
std::string what_;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue