server Settings

git-svn-id: svn://elaine/murooma/trunk@255 d8a302eb-03bc-478d-80e4-98257eca68ef
This commit is contained in:
(no author) 2014-09-12 15:04:17 +00:00
parent f7cf7a2537
commit 979f6460d3
11 changed files with 122 additions and 48 deletions

View file

@ -2,7 +2,7 @@
#include <iostream>
ControlServer::ControlServer(unsigned short port) : port_(port), headerChunk(NULL)
ControlServer::ControlServer(unsigned short port) : port_(port), headerChunk(NULL), sampleFormat(NULL)
{
}
@ -20,10 +20,13 @@ void ControlServer::acceptor()
{
socket_ptr sock(new tcp::socket(io_service_));
a.accept(*sock);
cout << "New connection: " << sock->remote_endpoint().address().to_string() << "\n";
cout << "ControlServer::NewConnection: " << sock->remote_endpoint().address().to_string() << "\n";
ServerConnection* session = new ServerConnection(this, sock);
sessions.insert(shared_ptr<ServerConnection>(session));
session->start();
session->send(serverSettings);
session->send(sampleFormat);
session->send(headerChunk);
}
}
@ -40,4 +43,28 @@ void ControlServer::stop()
}
void ControlServer::setHeader(HeaderMessage* header)
{
if (header)
headerChunk = header;
}
void ControlServer::setFormat(SampleFormat* format)
{
if (format)
sampleFormat = format;
}
void ControlServer::setServerSettings(ServerSettings* settings)
{
if (settings)
serverSettings = settings;
}