mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
forward protobuf messages.
configure (send proto messages to two other hyperiond): "protoServer" : { "port" : 19446, "forward" : [ "192.168.0.10:19445", "192.168.0.11:19445" ] }, Former-commit-id: 33af219cfce99609ca7245d662dc0f0561013bbd
This commit is contained in:
@@ -5,12 +5,15 @@
|
||||
#include <protoserver/ProtoServer.h>
|
||||
#include "ProtoClientConnection.h"
|
||||
|
||||
ProtoServer::ProtoServer(Hyperion *hyperion, uint16_t port) :
|
||||
ProtoServer::ProtoServer(Hyperion *hyperion, uint16_t port, QStringList * forwardClientList) :
|
||||
QObject(),
|
||||
_hyperion(hyperion),
|
||||
_server(),
|
||||
_openConnections()
|
||||
{
|
||||
for (int i = 0; i < forwardClientList->size(); ++i)
|
||||
_forwardClients << forwardClientList->at(i);
|
||||
|
||||
if (!_server.listen(QHostAddress::Any, port))
|
||||
{
|
||||
throw std::runtime_error("Proto server could not bind to port");
|
||||
@@ -39,7 +42,7 @@ void ProtoServer::newConnection()
|
||||
if (socket != nullptr)
|
||||
{
|
||||
std::cout << "New proto connection" << std::endl;
|
||||
ProtoClientConnection * connection = new ProtoClientConnection(socket, _hyperion);
|
||||
ProtoClientConnection * connection = new ProtoClientConnection(socket, _hyperion, _forwardClients);
|
||||
_openConnections.insert(connection);
|
||||
|
||||
// register slot for cleaning up after the connection closed
|
||||
|
Reference in New Issue
Block a user